隐藏 ICS 返回主页任务切换器按钮
只是想知道如何以编程方式隐藏 ICS 返回/主页/等软件按钮。就像 Youtube 应用程序在播放视频时所做的那样。我想在视频播放时隐藏它们,但在用户点击屏幕时将它们显示出来。
我似乎无法在网络上或谷歌文档中找到它。
Just wondering how to hide the ICS back/home/etc software buttons programmatically. Just like the Youtube apps does when playing a video. I want to hide them while a video is playing, but bring them up if the user taps the screen.
I can't seem to find it anywhere on the web, or in Google's documentation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
pinxue 非常适合...您想要SYSTEM_UI_FLAG_HIDE_NAVIGATION。示例:
不过,需要注意的一件事是,在任何(我的意思是任何)用户交互时,导航栏都会重新显示。
使用 Honeycomb,您最接近的是进入“熄灯”模式(现在称为“低配置”... SYSTEM_UI_FLAG_LOW_PROFILE )。这只会使导航栏上的项目不那么明显(您可能已经看到过的小“点”)。如果您想尽最大努力保持与 Honeycomb 的向后兼容性,您可以使用反射来使用“最佳”方法:
pinxue is spot-on... you want SYSTEM_UI_FLAG_HIDE_NAVIGATION. Example:
One thing to note, though, is that upon any (and I mean ANY) user interaction the navigation bar will be reshown.
With Honeycomb the closest you can get is to go into "lights out" mode (now called "low profile"... SYSTEM_UI_FLAG_LOW_PROFILE ). This just makes the items on the navigation bar less visible (the little "dots" you've probably seen). If you want to do the best you can at maintain backwards compatibility with Honeycomb you can use reflection to use the "best" method:
尝试使用标志 SYSTEM_UI_FLAG_HIDE_NAVIGATION 设置全屏窗口
try to setup a Full screen window with flag SYSTEM_UI_FLAG_HIDE_NAVIGATION
您需要 SYSTEM_UI_FLAG_HIDE_NAVIGATION 。
此标志是从 Ice Cream Sandwich API 14 开始添加的。在 14 之前,有一个标志 STATUS_BAR_HIDDEN 已在 Honeycomb API 11 中添加。在此之前,软导航按钮不存在,因此全屏模式完全由 主题(特别是Theme.NoTitleBar.Fullscreen)。
使用:
You want SYSTEM_UI_FLAG_HIDE_NAVIGATION .
This flag was added as of Ice Cream Sandwich, API 14. Previous to 14 a flag STATUS_BAR_HIDDEN was added in Honeycomb, API 11. Previous to that the soft navigation buttons didn't exist, so fullscreen modes were handled entirely by Themes (specifically Theme.NoTitleBar.Fullscreen).
Use:
这个答案可能没有直接回答问题。但我发布它可能会帮助其他人节省时间。
我需要完全隐藏导航栏。即使用户单击屏幕,它也应该保持隐藏状态。
以上对我来说都不起作用。
很久以前,我在谷歌搜索这个主题几天后写了一个课程。我最终上了这门课。
UtilsTaskBar.java
我无法在任何地方测试它,但它可以在 4.**
注意:我将此类用于特殊用途的应用程序,不适合典型用户。
如果您使用此类隐藏导航栏,则在您重新启动设备或使用同一类再次显示它之前,它不会再次显示。
因此,仅当您确实需要时才使用它。
This answer may not be directly answering the question. but i am posting it that it may help others to save time.
I needed to do hide the Nav bar completely. Even when user click the screen it should stay hidden.
Nothing of the above worked for me.
I wrote a class after couple of days of googling this topic long time ago. I end up on this class.
UtilsTaskBar.java
I couldn't test it everywhere, but it works on 4.**
NOTE: I used this class for special purpose applications, which is not for typical users.
If you hide the Navigation bar with this class, it wont be shown again till u restart the device or you show it again with same class.
So use it only if you really need it.
在AndroidManifest.xml中添加以下内容:
然后您可以使用此功能来显示和隐藏主页/返回导航栏
in AndroidManifest.xml add this:
then you can use this function to show and hide the home/return navigation bar
当他们在应用程序中谈论它时,它被称为“熄灯模式”。我找不到与 ICS 相关的任何内容,但这里有一个 Honeycomb 讨论的链接。
执行熄灯模式的 api 调用在哪里蜂窝状
It's called "Lights Out Mode" when they talk about it in the apps. I couldn't find anything related to ICS but here's a link to a Honeycomb discussion.
where is api call to do lights out mode in honeycomb