【发布时间】:2021-07-22 21:16:14
【问题描述】:
我正在使用 XML 方法来实现我的启动画面(为了避免在冷启动期间出现该空白屏幕)。 但问题是我的背景不会随着夜间模式而改变,它仍然是白色的。 谁能指导我?
res\drawable\splash_screenbg.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>
And My Theme / Theme- Night Resource 文件包含此样式 res\themes.xml 要么 res\themes.xml(夜晚)
<!--Splash Screen-->
<style name="SplashScreen" parent="Theme.StookPTU">
<item name="android:windowBackground">@drawable/splash_screenbg</item>
</style>
这是我的清单文件中的片段 清单\AndroidManifest.xml
<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>
【问题讨论】:
标签: android xml splash-screen