Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 4.4 translucent Status and Navigation bars style on Android 5.0

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?

enter image description here

like image 579
AxeEffect Avatar asked Oct 20 '14 20:10

AxeEffect


People also ask

How do I show navigation bar on Android?

Simply just go to Settings -> Display ->Navigation Bar.

How do I change the color of my status 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.


2 Answers

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.

like image 121
suckgamony Avatar answered Oct 07 '22 00:10

suckgamony


Add below line to your style:

<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentNavigation">true</item> 
like image 44
Kuldeep Sakhiya Avatar answered Oct 06 '22 23:10

Kuldeep Sakhiya