Bahadir Gul
Bahadir Gul

Reputation: 150

How to Hide Navigation Bar Permanently in Android

I am trying to hide navigation bar at bottom in my app.

With following code in my onCreate I can hide it. But when I press screen or press volume buttons it comes up again.

View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

How can I permanently hide navigation bar.

Upvotes: 0

Views: 5029

Answers (3)

Evish Verma
Evish Verma

Reputation: 1037

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

Call this method on your onCreate

Upvotes: 0

Bahadir Gul
Bahadir Gul

Reputation: 150

Hi I did it with using

View.SYSTEM_UI_FLAG_IMMERSIVE and

SYSTEM_UI_FLAG_HIDE_NAVIGATION flags same time.

It requires 4.4 but my version is 4.2.2.

Thats why I couldn't do it before. Thank you all for your answers and consern.

Upvotes: 0

Ali Abhas
Ali Abhas

Reputation: 107

Add this Code In to Your onCreate() Method it will work for you But android version 4.4 or higher

View decor_View = getWindow().getDecorView();

int ui_Options = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

decor_View.setSystemUiVisibility(ui_Options);

Upvotes: 2

Related Questions