简体   繁体   English

如何隐藏导航栏?

[英]How to hide the navigation bar?

I've got a problem with my Android app (it's my first app). 我的Android应用程序有问题(这是我的第一个应用程序)。 In few words, when I press the volume up or volume down buttons (and also when an alert comes up) the navigation bar appear and completely mess up the layout. 简而言之,当我按下“提高音量”或“降低音量”按钮时(以及出现警报时),导航栏就会出现并完全弄乱了布局。
NavigationBar 导航栏

Assuming that I'm using this code to hide the nav bar (it's the immersive mode) 假设我正在使用此代码隐藏导航栏(这是身临其境的模式)

 public void FullScreencall(){
    if(Build.VERSION.SDK_INT<19){
        View v =this.getWindow().getDecorView();
        v.setSystemUiVisibility(View.GONE);
    }
    else{
        View decorView=getWindow().getDecorView();
        int uiOptions= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        decorView.setSystemUiVisibility(uiOptions);
    }
}

(Called in OnCreate) How can I solve this problem? (在OnCreate中称为)如何解决此问题? I just want the nav bar to not appear at all. 我只希望导航栏根本不出现。 Thanks for the attention. 感谢您的关注。

您应该在onResume或onFocusChanged中调用IMMERSIVE_STICKY。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM