Notification Bar is grey after implementing Nav Drawer

前端 未结 1 1380
一生所求
一生所求 2021-02-15 01:50

I am trying to learn implementations of Navigation Drawer in Android.

In one activity, i have made the Navigation Drawer come under the Status Bar(transparent) and over

1条回答
  •  时光取名叫无心
    2021-02-15 02:47

    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:

    true
    @color/primary_dark
    

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

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