Overlap a Transparent Status Bar

There’s a lot going on about making your Status Bar transparent for your Activities. But most of the time, its easier said than done and if android:fitsSystemWindows = "true"¬†doesn’t work for you, then¬†there is another way.

Add this before your setContentView()

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
            getWindow().setStatusBarColor(getResources().getColor(R.color.black_trans80,null));

}

Remember that a transparent Status Bar works only on Lollipop and above. For Android KitKat 4.4 it is translucent. Android Jelly Bean 4.2 and below, it remains black and there’s nothing you can do about that.

The Status Bar color here could be anything, but as per norms it must be 20% opacity black.

NOTE: Don’t forget to add a 24dp padding to your Toolbar top, since it will now be under the Status Bar.

An App developer with an eye for design. Loves to create apps with good UI/ UX that people appreciate. In his spare time, he likes to draw and paint.

Recommended Android Books to Read

Suleiman

An App developer with an eye for design. Loves to create apps with good UI/ UX that people appreciate. In his spare time, he likes to draw and paint.