[英]How to set color for BottomNavigationView?
I need to use android:background="?android:attr/windowBackground", but so that the day and night versions have different values.我需要使用 android:background="?android:attr/windowBackground",但白天和夜晚的版本具有不同的值。 How can I do this?
我怎样才能做到这一点? Is it possible to do this with using colors.xml and themes.xml
是否可以使用 colors.xml 和 themes.xml 来做到这一点
First of all define night-value folder and night theme in appropriate resource directory.首先在合适的资源目录下定义night-value文件夹和night theme 。
res/values-night/themes.xml res/values-night/themes.xml
Override android:windowBackground
like this:像这样覆盖
android:windowBackground
:
<style name="LaunchTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/screen_night</item>
</style>
Then you can customize your screen like this:然后你可以像这样自定义你的屏幕:
res/drawable/screen_night.xml 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.