MaterialDrawer: I can't make the status bar full transparent

Hello,

I want to set the status bar background color to completely transparent. But i can’t change it stays half transparent (black), i just can’t change it.

I tried set them in my theme

   <style name="AppThemeMeterialCompat" parent="MaterialDrawerTheme.Light.DarkToolbar.TranslucentStatus">
   <item name="colorPrimaryDark">@android:color/transparent</item>
   <item name="android:windowTranslucentNavigation">true</item>
   <item name="android:windowNoTitle">true</item>
   <item name="android:windowTranslucentStatus">true</item>
   </style>

and them in the builder

     .withTranslucentStatusBar(true)
     .withFullscreen(true)

Please help

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@buraktamturk you can achieve this by doing following:


@Override
    protected void onCreate(Bundle savedInstanceState) {
        ...

        //make full transparent statusBar
        if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
            setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, true);
        }
        if (Build.VERSION.SDK_INT >= 19) {
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        }
        if (Build.VERSION.SDK_INT >= 21) {
            setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
            getWindow().setStatusBarColor(Color.TRANSPARENT);
        }
    }

    public static void setWindowFlag(Activity activity, final int bits, boolean on) {
        Window win = activity.getWindow();
        WindowManager.LayoutParams winParams = win.getAttributes();
        if (on) {
            winParams.flags |= bits;
        } else {
            winParams.flags &= ~bits;
        }
        win.setAttributes(winParams);
    }

@pesjak this answer is outdated. please see the sample app for various implementations, including one with a fullscreen behavior.

the flags are btw. plain android here. and the “|” and so on are binary operations

Thanks buddy is Its working