Sazid Sazid - 16 days ago 5
Android Question

How to change the status bar notification icons' color/tint in android (marshmallow and above 23+)?

As the title says, how do I change the status bar icons' color to have a dark tint instead of the default white.

FROM

enter image description here

TO

dark status bar

Answer

For the status bar icons' to have a dark tint instead of the default white, add the following tag in your styles.xml (or more precisely in values-v23/styles.xml) file:

<item name="android:windowLightStatusBar">true</item>

You can also change the flag at runtime by setting it to any View:

View yourView = findViewById(R.id.your_view);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    if (yourView != null) {
        yourView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }
}

If you want to reset the changes, clear the flag like this:

yourView.setSystemUiVisibility(0);
Comments