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

前端 未结 2 1338
被撕碎了的回忆
被撕碎了的回忆 2020-12-02 13:40

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

FROM

TO

2条回答
  •  一个人的身影
    2020-12-02 14:30

    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:

    true
    

    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);
    

提交回复
热议问题