Android 启动屏幕';s的颜色不会在夜间模式下更新
我正在使用XML方法实现我的启动屏幕(以避免冷启动时出现空白屏幕)。 但问题是我的背景不会随着夜间模式而改变,它仍然是白色的。 有人能带我出去吗 res\drawable\splash\u screenbg.xmlAndroid 启动屏幕';s的颜色不会在夜间模式下更新,android,xml,splash-screen,Android,Xml,Splash Screen,我正在使用XML方法实现我的启动屏幕(以避免冷启动时出现空白屏幕)。 但问题是我的背景不会随着夜间模式而改变,它仍然是白色的。 有人能带我出去吗 res\drawable\splash\u screenbg.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/mainBG" />
<!--
<item>
<bitmap
android:gravity="center"
android:src="@drawable/signin_img"/>
</item>
-->
</layer-list>
<activity
android:name=".SplashScreen"
android:screenOrientation="portrait"
android:theme="@style/SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
我的主题/主题夜资源文件包含这种风格
res\themes.xml
或
res\themes.xml(夜间)
@可拉伸/飞溅屏幕BG
这是我清单文件中的代码片段
清单\AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/mainBG" />
<!--
<item>
<bitmap
android:gravity="center"
android:src="@drawable/signin_img"/>
</item>
-->
</layer-list>
<activity
android:name=".SplashScreen"
android:screenOrientation="portrait"
android:theme="@style/SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
添加到colors.xml(night):
#000000
或者将颜色更改为您的自定义颜色。我添加了它,但它仍然不起作用