On Android 4.4 KitKat you can set the Status and Navigation bars transparent with the android:windowTranslucentStatus
and android:windowTranslucentNavigat
Set android:windowTranslucentStatus
to false and set android:statusBarColor
to @android:color/transparent
.
Then add code below:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
If you also want the navigation bar to be translucent, set android:navigationBarColor
to @android:color/transparent
and combine the flag View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
as well.
I didn't experiment on the navigation bar but it will work.
To clarify @suckgamony's answer to this question:
android:statusBarColor
or android:navigationBarColor
to @android:color/transparent
will make the Status Bar or Navigation Bar (respectively) completely transparent, unless:android:windowTranslucentStatus
or android:windowTranslucentNavigation
is set to true, in which case the Status Bar or Navigation Bar (respectively) is set to the solid transparent color @AxeEffect describes (again, under Lollipop and above);android:statusBarColor
and android:navigationBarColor
may only be used with Android version 21 (Lollipop 5.0) or higher. As described in the referred to answer, android:windowTranslucentStatus
or android:windowTranslucentNavigation
when used with Kitkat provide transparent gradients rather than full transparency.Add below line to your style:
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>