Muhammad Ali Muhammad Ali - 1 year ago 200
Android Question

Android Completely transparent Status Bar?

I've searched the documentation but only found this:
Link. Which is used to make the bar translucent. What I'm trying to do is to make the status bar completely transparent (as shown in the image below) and make it backward compatible for APK<19:
enter image description here

My styles.xml:

< resources xmlns: tools = "" >

< style name = "AppTheme" parent = "Theme.AppCompat.Light" >
< item name = "android:actionBarStyle" > @style / ThemeActionBar < /item>
<item name="android:windowActionBarOverlay">true</item >
<!-- Support library compatibility -->
< item name = "actionBarStyle" > @style / ThemeActionBar < /item>
<item name="windowActionBarOverlay">true</item >
</style >

< style name = "ThemeActionBar"
parent = "Widget.AppCompat.Light.ActionBar.Solid" >
< item name = "android:background" > @null < /item>
<!-- Support library compatibility -->
<item name="background">@null</item >
< item name = "android:displayOptions" > showHome | useLogo < /item>
<item name="displayOptions">showHome|useLogo</item >

< /style>

</resources >

What I was able to do:

enter image description here

Answer Source

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:


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

            Window w = getWindow(); // in Activity's onCreate() for instance
            w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

No other theme-ing is necessary, it produces something like this:

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download