简体   繁体   中英

How to hide the navigation bar?

I've got a problem with my Android app (it's my first app). 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? I just want the nav bar to not appear at all. Thanks for the attention.

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

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