0

I am going to make the status bar as a transparent in android. This is the screenshot same of our app status.enter image description here

But I hope to make the status like this image. enter image description here

Please tell me how to make the status as a transparent color. Thanks in advance.

DevCaf
  • 109
  • 11

2 Answers2

1

All you need to do is set these properties in your theme:

<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>

Your activity / container layout you wish to have a transparent status bar needs this property set:

android:fitsSystemWindows="true"

It is generally not possible to perform this for sure on pre-kitkat, looks like you can do it but some strange code makes it so.

EDIT: I would recommend this lib: https://github.com/jgilfelt/SystemBarTint for lots of pre-lollipop status bar color control.

Well after much deliberation I've learned that the answer to totally disabling the translucency or any color placed on the status bar and navigation bar for lollipop is to set this flag on the window

// In Activity's onCreate() for instance
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    Window w = getWindow();
    w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
Suhaib Raadan
  • 1,239
  • 1
  • 9
  • 17
0

Have you tried add

<item name="android:windowTranslucentStatus">true</item>

to your AppTheme style in style.xml ?

Brian H.
  • 1,603
  • 11
  • 16
  • I tried to add this item but still making the grey color of status bar in app. – DevCaf Jun 26 '20 at 09:08
  • That weird :| did this question solve your problem: https://stackoverflow.com/a/29311321/11888658, cause I think that this transparent status bar behavior may depend on device version. – Brian H. Jun 26 '20 at 09:11