在清单中设置Android沉浸式全屏模式

问题描述:

在新的KitKat中,具有沉浸式全屏模式,可以像这样使用:

In the new KitKat there is immersive full screen mode that can be used like this:

要为您的应用提供可以覆盖整个屏幕的布局, setSystemUiVisibility()的新SYSTEM_UI_FLAG_IMMERSIVE标志(当 与SYSTEM_UI_FLAG_HIDE_NAVIGATION结合使用可实现新的沉浸式 全屏模式.

To provide your app with a layout that fills the entire screen, the new SYSTEM_UI_FLAG_IMMERSIVE flag for setSystemUiVisibility() (when combined with SYSTEM_UI_FLAG_HIDE_NAVIGATION) enables a new immersive full-screen mode.

http://developer.android.com/about/versions/android-4.4.html#UI

我想知道是否可以为清单中的活动或完整应用程序设置此模式?

I'm wondering if it is possible to set this mode for an Activity or full application in the manifest?

无法在清单或只能通过视图级别的 SYSTEM_UI_FLAG_IMMERSIVE 标志使用是一个请求,而不是任务,它是一种临时模式.

It's only available via the view-level SYSTEM_UI_FLAG_IMMERSIVE flags, which indicates that it is a request, not a mandate - and that it is a temporary mode.

系统可以随时选择忽略请求或退出沉浸式模式,您的应用应处理这些情况.

The system may choose to ignore the request or exit immersive mode at any time, your app should handle those cases.

还值得指出的是,在移动设备上隐藏主要导航并不是一件容易的事.并非适用于所有应用程序,因此不要无所事事.

It's also worth pointing out that hiding the primary navigation on a mobile device is not something to be taken lightly. It's not appropriate for all apps, and should not be done without thought.