Android Lollipop Set Status Bar Text Color

后端 未结 7 1135
遇见更好的自我
遇见更好的自我 2020-12-14 06:30

I\'m trying to set the status bar text color in Android v21, but I\'m not seeing an API method for it. Here\'s what I have so far for the background

MyActivity.java

相关标签:
7条回答
  • 2020-12-14 07:22

    FOR ANDROID 6.0+

    You can use this to change the status bar content color to light on black background, as shown in below image.

    View decorView = this.getWindow().getDecorView();
    int systemUiVisibilityFlags = decorView.getSystemUiVisibility();
    systemUiVisibilityFlags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
    decorView.setSystemUiVisibility(systemUiVisibilityFlags);
    

    By default, it is black so leave it for the light background.

    0 讨论(0)
提交回复
热议问题