简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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