Android tablet navigation bar won't hide

前端 未结 4 1994
死守一世寂寞
死守一世寂寞 2020-12-10 23:11

I\'m trying to hide the navigation bar, using methods I\'ve found described on the internet.

I have a simple layout which shows a WebView:



        
相关标签:
4条回答
  • 2020-12-10 23:23

    May be this helps:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        getWindow().setUiOptions(//
        View.SYSTEM_UI_FLAG_FULLSCREEN|//
        View.SYSTEM_UI_FLAG_IMMERSIVE|//
        View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    
        setContentView(R.layout.main);
    
        findViewById(R.id.main).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.setSystemUiVisibility(//
                    View.SYSTEM_UI_FLAG_FULLSCREEN|//
                    View.SYSTEM_UI_FLAG_IMMERSIVE|//
                    View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
            }
        });
    }
    
    0 讨论(0)
  • 2020-12-10 23:39

    You cannot permanently hide the system bar on a tablet.

    SYSTEM_UI_FLAG_HIDE_NAVIGATION on Android 4.1 and higher will hide the system bar, but it will reappear as soon as the user does anything.

    0 讨论(0)
  • 2020-12-10 23:43

    You can not hide the navigation bar within the given framework. However, there is a work around if rooting the device is an option for you:

    1. Root device

    2. Install and run Busybox

    3. Install HideBar

    In HideBar there is an option to run in 'Kiosk' mode, in which there is no way to re-display the navigation bar. Needless to say, you really need to be careful with this.


    0 讨论(0)
  • 2020-12-10 23:49

    you can hide the navigationbar,try this

    public void FullScreencall() {
        if(Build.VERSION.SDK_INT < 19) //19 or above api
            View v = this.getWindow().getDecorView();
            v.setSystemUiVisibility(View.GONE);
        } else {
                //for lower api versions.
            View decorView = getWindow().getDecorView(); 
            int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            decorView.setSystemUiVisibility(uiOptions);
        }
    }
    
    0 讨论(0)
提交回复
热议问题