【发布时间】:2016-08-28 12:22:20
【问题描述】:
我正在为运行 android 4.4.4 的特定平板电脑开发应用程序。不允许用户关闭应用程序。我希望有一种方法可以完全隐藏或禁用导航栏,但我似乎找不到解决方案。我已经尝试使用Using Immersive fullscreen 上解释的方法,但似乎没有任何效果。有什么建议吗?
【问题讨论】:
标签: java android navigation hide navigationbar
我正在为运行 android 4.4.4 的特定平板电脑开发应用程序。不允许用户关闭应用程序。我希望有一种方法可以完全隐藏或禁用导航栏,但我似乎找不到解决方案。我已经尝试使用Using Immersive fullscreen 上解释的方法,但似乎没有任何效果。有什么建议吗?
【问题讨论】:
标签: java android navigation hide navigationbar
您可以使用 SYSTEM_UI_FLAG_HIDE_NAVIGATION 标志隐藏导航栏。
试试这个代码
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
【讨论】: