简体   繁体   English

如何在 Android 中永久隐藏导航栏

[英]How to permanently hide Navigation Bar in an Android

I am making an application,and have access to system permissions.我正在制作一个应用程序,并且可以访问系统权限。 I want to make the navigation bar hide permanently, It should not appear even on user interaction.我想让导航栏永久隐藏,即使在用户交互时也不应该出现。

Now i'm using this piece of code, it hides the bar but when user touches the screen it showing again.现在我正在使用这段代码,它隐藏了栏,但是当用户触摸屏幕时它再次显示。 is there any way to hide it permanently until activity onStop();有没有办法永久隐藏它,直到活动 onStop();

protected void hideBottomUIMenu() {
  
    if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api
        View v = this.getWindow().getDecorView();
        v.setSystemUiVisibility(View.GONE);
    } else if (Build.VERSION.SDK_INT >= 19) {
        Window _window = getWindow();
        WindowManager.LayoutParams params = _window.getAttributes();
        params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_IMMERSIVE;
        _window.setAttributes(params);
        
    }
}

Any technical advice or comments/suggestions on the best implementation would be hugely appreciated.任何关于最佳实施的技术建议或评论/建议将不胜感激。

I hope this might be helpful for you.我希望可能对你有所帮助。 Also look at this也看看这个

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

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