[英]How to make Status bar completely white?
At different times when using my app, the color of the status bar changes, the right would be white as in the first image, but at times it turns gray.在使用我的应用程序的不同时间,状态栏的颜色会发生变化,右边会像第一张图片一样是白色的,但有时它会变成灰色。 What can this be?
这可以是什么? Android bug?
安卓漏洞? Here it is completely white Here it is already gray, after entering the app time after
这里是全白这里已经是灰色了,进入app时间后
styles.xml:样式.xml:
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="android:windowLightStatusBar">true</item>
<item name="colorPrimaryDark">#ffffff</item>
<item name="colorAccent">@color/accent</item>
</style>
To change the color for above api 21 just add this to your styles.xml
要更改上述api 21的颜色,只需将其添加到您的
styles.xml
<item name="android:statusBarColor">@color/statusBarColor</item>
if you want to have a light color for the status bar, add this line too如果您想为状态栏设置浅色,也请添加此行
<item name="android:windowLightStatusBar">true</item>
Edit :编辑 :
if it keeps changing color , so try to change your color in you activities this way :如果它一直在改变颜色,那么尝试以这种方式改变你活动中的颜色:
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.white)); // Navigation bar the soft bottom of some phones like nexus and some Samsung note series
getWindow().setStatusBarColor(ContextCompat.getColor(this,R.color.white)); //status bar or the time bar at the top
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.