Android - 带有非透明导航栏的全透明状态栏 [英] Android - Fully transparent status bar with non transparent navigation bar

查看:36
本文介绍了Android - 带有非透明导航栏的全透明状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种在状态栏完全透明(不是半透明)的情况下重新着色导航栏的方法.使状态栏完全透明需要将布局标志设置为 NO_LIMITS,但这也会使导航栏失去颜色.有什么办法可以做到这一点吗?

I have been looking for a way to re-color the navigation bar while the status bar is fully transparent (not translucent). Getting the status bar to be completely transparent requires the layout flags to be set to NO_LIMITS but that also makes the navigation bar lose its color. Is there any way to achieve this?

推荐答案

如果你不需要状态栏文字变暗,下面的方法可行.

If you do not need the status bar text to be dark, the following works.

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

并按照@JaviChaqués 的建议更改导航栏颜色.

And change the navigation bar color as @JaviChaqués suggest.

这篇关于Android - 带有非透明导航栏的全透明状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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