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.

Android Material UI Template 8 in 1 CodeCanyon
icon icon

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

Subscribe to stay updated
You'll be first to know about new articles and more. They're sent straight to your inbox!
No Spam, no BS. Promise. You can unsubscribe anytime.

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

Udemy

Suleiman

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

Subscribe to stay updated
You'll be first to know about new articles and more. They're sent straight to your inbox!
No Spam, no BS. Promise. You can unsubscribe anytime.
Gradle setup, ProGuard rules, Material Design palette, metrics and much more

FREE Material Design Starter Project

For more details, click on the below link.
GET IT NOW FOR ANDROID STUDIO!
Download FREE
STARTER PROJECT
Material Design Template Project for Android Studio
95% OFF on Machine Learning with Python Course

Use Coupon Code: CODESTARS