user10309546
user10309546

Reputation:

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

styles.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>    

Upvotes: 0

Views: 54

Answers (1)

ismail alaoui
ismail alaoui

Reputation: 6073

To change the color for above api 21 just add this to your 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
  }

Upvotes: 2

Related Questions