我需要使用android:background="?android:attr/windowBackground",但是白天和晚上的版本有不同的值.我该怎么做?是否可以使用 colored颜色 来实现这一点.xml和主题.xml
我需要使用android:background="?android:attr/windowBackground",但是白天和晚上的版本有不同的值.我该怎么做?是否可以使用 colored颜色 来实现这一点.xml和主题.xml
其中First个在适当的资源目录中定义night-value文件夹和night theme.
res/values-night/themes.xml
Overrideandroid:windowBackground
像这样:
<style name="LaunchTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/screen_night</item>
</style>
然后你可以像这样定制你的屏幕:
res/drawable/screen_night.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="@color/white"/>
</item>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/any_logo"
android:tileMode="disabled"/>
</item>