On Android 4.4 KitKat you can set the Status and Navigation bars transparent with the android:windowTranslucentStatus
and android:windowTranslucentNavigation
theme elements, and then below the bars the app window is extended and a gradient is added. However on Android 5.0 Lollipop this has been changed and now instead of the gradient a solid transparent color is added. Android 5.0 offers the new android:statusBarColor
and android:navigationBarColor
elements under the new Material theme, but when you try to set these elements to @android:color/transparent
the app window is not extended, and if you use android:windowTranslucentStatus
and android:windowTranslucentNavigation
then android:statusBarColor
and android:navigationBarColor
are ignored.
Am I missing something described on http://developer.android.com/training/material/theme.html#StatusBar?
Simply just go to Settings -> Display ->Navigation Bar.
Step 1: After opening the android studio and creating a new project with an empty activity. Step 2: Navigate to res/values/colors. xml, and add a color that you want to change for the status bar. Step 3: In your MainActivity, add this code in your onCreate method.
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.
Add below line to your style:
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentNavigation">true</item>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With