如何在android

时间:2015-10-28 13:58:01

标签: android

As Shown in the pic below

  1. 可以在Android
  2. 中禁用导航栏
  3. 我试图禁用所有这三个功能,
  4. 我正在处理的要求是锁定屏幕,因此可以在android
  5. 支持此
  6. 的任何现有答案

    enter image description here

2 个答案:

答案 0 :(得分:1)

您可以通过执行以下操作隐藏导航栏:

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
          | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);

要使内容显示在导航栏后面,您需要使用SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION。您可能还需要使用SYSTEM_UI_FLAG_LAYOUT_STABLE来帮助您的应用保持稳定的布局。

您可能希望使用沉浸式全屏模式。查看this link了解详情。

答案 1 :(得分:0)

您可以使用以下样式隐藏操作栏:

<style name="MyTheme" parent="android:Theme.Holo.Light">
    <item name="android:windowActionBar">false</item>
    <item name="android:windowNoTitle">true</item>
</style>

要隐藏导航栏,请使用以下内容并参阅this

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);