Notification Bar is grey after implementing Nav Drawer

前端 未结 1 1372
走了就别回头了
走了就别回头了 2021-02-15 02:15

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:39

    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)
提交回复
热议问题