niorgai / StatusBarCompat

Status Bar Utils ---- Change Status Bar Mode Simply

Home Page:http://niorgai.github.io/2016/03/20/Android-transulcent-status-bar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

设置透明状态栏会让状态栏文字颜色变为白色

zhangls2014 opened this issue · comments

在 Style 文件中设置 <item name="android:windowLightStatusBar">true</item> ,然后在 Activity 中使用本库提供的方法设置状态栏透明。会导致状态栏文字并不能显示为黑色,任然显示为修改前的白色

commented

According to the document:

For this to take effect, the window must be drawing the system bar backgrounds with windowDrawsSystemBarBackgrounds and the status bar must not have been requested to be translucent with windowTranslucentStatus.

But in my lib, i set the windowTranslucentStatus to true, so it don't work.

好的,明白了,谢谢!

commented

我今天又试了一下, 感觉文档上面说的不太对, 在调用 lib 方法之后再调用变色的方法是可行的, 我在 Pixel 2 XL 上测试 ok.

你可以试试以下代码来让状态栏变深色.

View view = getWindow().getDecorView();
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | view.getSystemUiVisibility());

经过测试,您的方法是可行的,谢谢!

commented

那就好 我也更新了新版了