如何隐藏或禁用导航底部平板电脑?

时间:2018-07-23 20:57:44

标签: android

我想在Android中隐藏或禁用导航底部平板电脑。我可以搜索并使用

getWindow().getDecorView().setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

但是当焦点EditText时,键盘出现并且导航也出现。当键盘出现导航隐藏按钮或帮我禁用导航按钮时,您可以帮我吗?谢谢

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以使用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);

来源:developer.android.com