Android的状态栏覆盖与动作条 [英] Android statusbar overlay with ActionBar
问题描述
我知道我可以用做动作条覆盖 requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY)
并且可以切换/显示在我的屏幕状态栏(通过的 FLAG_FULLSCREEN
开关和 FLAG_FORCE_NOT_FULLSCREEN
)。
这个伟大的工程。不过,我不希望我的布局,移动的,当我切换状态栏。
I know that I can make the ActionBar overlay using requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY)
and can toggle/show the status bar in my screen (by switching between FLAG_FULLSCREEN
and FLAG_FORCE_NOT_FULLSCREEN
).
This works great. However, I don't want my layout moving when I toggle the status bar.
我知道我可以在状态栏叠加(尽管不是透明)使用的内容:
I know that I can make the status bar "overlay" (albeit not transparently) the content using:
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
这工作也很大,除了(预期)结果是,使用一个动作条的时候,在动作条被半停产 - 一半是在基本状态栏
This works also great, except for the (expected) consequence that, when using an ActionBar, the ActionBar gets half cut off - half of it is under the status bar basically.
所以我想知道,有没有办法通过状态栏的身高在这种情况下将动作条下?
我知道,在最坏的情况下,我可以住在布局中的自定义视图这样做,但我宁愿不做这个(希望从动作条中受益)。
So I am wondering, is there a way to "move the ActionBar down" by the status bar's height in this case?
I know that in worse case, I can do this with a custom view that lives within the layout, but I rather not do this (want to benefit from the ActionBar).
谢谢!
推荐答案
那么显然,你可以在杰利贝恩做到这一点。谷歌包括API文档的两个例子。这里是一个链接:的http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility%28int%29
so apparently, you can do this in Jellybean. google includes two examples in the api docs. here is a link: http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility%28int%29
摘要:
使用 setSystemUiVisibility
在视图切换可见性(在软糖+)。
summary:
use setSystemUiVisibility
on a view to toggle visibility (on jellybean+).
这篇关于Android的状态栏覆盖与动作条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!