react-native-bootsplashwindowSplashScreenBackground无常工作的 Andro

在这个问题上花费了几天后,我正在寻求您的帮助。我将我的项目升级为 react-native 0.69.5 和 react-native-bootsplash 4.3.2。

在这个问题上花费了几天后,我正在寻求您的帮助。我将我的项目升级为 react-native 0.69.5 和 react-native-bootsplash 4.3.2。

我试图用图标和背景颜色自定义初始屏幕,但只有图标显示出来。

这是我的 styles.xml 文件:

<resources>
  <!-- Base application theme. -->
  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">@color/green</item>
    <item name="android:forceDarkAllowed">false</item>
    <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
  </style>
  <!-- BootTheme should inherit from Theme.SplashScreen -->
  <style name="BootTheme" parent="Theme.SplashScreen">
    <item name="windowSplashScreenBackground">@color/green</item>
    <item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item>
    <item name="postSplashScreenTheme">@style/AppTheme</item>
  </style>
</resources>

我的 colors.xml 看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="green">#08ba58</color>
    <color name="black">#000000</color>
    <color name="dark_green">#08776c</color>
</resources>

和我的 AndroidManifest.xml 文件:

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.****.****">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <application
        android:name=".MainApplication"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:allowBackup="false"
        android:theme="@style/BootTheme"
        android:networkSecurityConfig="@xml/network_security_config">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustResize"
            android:exported="true"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/app_scheme"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https"
                        android:host="****.****/****"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https"
                        android:host="****.****/****"/>
            </intent-filter>
        </activity>
        <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/google_geo_api_key"/>
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
        <meta-data android:name="com.facebook.sdk.Token" android:value="@string/facebook_client_token"/>
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_stat_ic_notification" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/black"
            tools:replace="android:resource" />
        <meta-data
            android:name="com.google.android.gms.wallet.api.enabled"
            android:value="true" />
    </application>
</manifest>

然后我在 MainActivity.java 中实现了 onCreate 函数,如下所示:

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    RNBootSplash.init(this);
    super.onCreate(null);
  }

Here is the result: splashscreen with black background

But the expected result would be something like this (not the real color, not the real icon, but you get the idea): splashscren with green background

你知道为什么它不工作吗?

非常感谢你!

0

您是否尝试在此命令中放置所需的颜色,从而生成闪屏

yarn react-native generate-bootsplash ets/bootsplash_logo_original.png 
  --background-color=F5FCFF \
  --logo-width=100 \

本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处

(456)
在给定范围内查找函数的根(root of the function)
上一篇
使用DNS重定向到具有路径的另一个URL
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(26条)