简体   繁体   中英

Fully Transparent Navigation Bar and Status Bar

I want to make a fully transparent status bar and navigation bar like Google Play did. When I use window settings to achieve it, the keyboard covers EditText.

When this code used EditText covered by Keyboard Input:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
                      WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Also this code doesn't make it fully transparent, it just makes it translucent

getWindow().setNavigationBarColor(Color.TRANSPARENT)

or this

<item name="android:navigationBarColor">@android:color/transparent</item>

I need a window like this:

在此处输入图片说明

I want to make fully transparent status bar and navigation bar like Google Play did. When i use window settings to achieve it, keyboard covers EditText.

When this code used EditText covered by Keyboard Input:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
                      WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Also this code doesn't make fully transparent, it just makes translucent

getWindow().setNavigationBarColor(Color.TRANSPARENT)

or this

<item name="android:navigationBarColor">@android:color/transparent</item>

I need window like this:

在此处输入图片说明

Hopefully, you can try this in your-main-path/res/values/styles.xml This is for transparent Status Bar and Navigation Bar in any android devices.

<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>

One more thing if you want to try transparency and float the to the bar you can use this but the background of Navigation Bar will reduce 50% of transparency.

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

When you want to unset the TranslucentNavigation float, this one can fit the screen between Status Bar and Navigation Bar

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM