[SOLVED] How do I hide the navigation bar?


#1

I already tried

    view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

in onCreate(), but when the screen is touched, the navigation bar returns. Does anyone know how to keep it off the screen? All I want is a fullscreen game.


#2

I copied code out of Android Studio’s fullscreen activity.
All you have to do is put this in your AndroidHarness onCreate method:

    ActionBar actionBar = this.getActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
    view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);