在Android 5.0的Andr​​oid 4.4半透明状态和导航栏样式 [英] Android 4.4 translucent Status and Navigation bars style on Android 5.0

查看:776
本文介绍了在Android 5.0的Andr​​oid 4.4半透明状态和导航栏样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 4.4奇巧,您可以设置状态栏和导航栏透明与安卓windowTranslucentStatus 安卓windowTranslucentNavigation 主题元素,然后下面条的应用程序窗口,延长和梯度增加。然而在Android 5.0棒棒糖这已被改变,而不是现在梯度实心透明颜色被添加。安卓5.0提供了新的安卓statusBarColor 安卓:在新材料主题navigationBarColor 元素,但是当你尝试设置这些元素 @android:彩色/透明应用程序窗口没有延长,而如果使用安卓windowTranslucentStatus 安卓windowTranslucentNavigation 然后安卓statusBarColor 安卓navigationBarColor 被忽略。

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.

我缺少对<所描述的东西href="http://developer.android.com/training/material/theme.html#StatusBar">http://developer.android.com/training/material/theme.html#StatusBar?

推荐答案

安卓windowTranslucentStatus 的并置机器人:statusBarColor @android:彩色/透明

然后添加code:

getWindow().getDecorView().setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

如果你也想导航条是半透明的,集安卓navigationBarColor @android:彩色/透明并结合标志 View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

If you also want 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 experimented on navigation bar but it will work.

这篇关于在Android 5.0的Andr​​oid 4.4半透明状态和导航栏样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆