Notification Bar is grey after implementing Nav Drawer

好久不见. 提交于 2019-12-03 13:03:00

But here, the status bar turns grey for some reason

It's the translucent (25% black) status bar background over the white background of activity underneath it.

What i want to know is how to make the status normal

You need to disable translucent status bar for the second activity. It is activated by this line in your theme definition:

<item name="android:windowTranslucentStatus">true</item>
<item name="android:statusBarColor">@color/primary_dark</item>

So either define a child theme and override the flag with false or clear the flag programmatically by calling this from your activity:

if (Build.VERSION.SDK_INT >= 21) {
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!