Sharanjeet Kaur Sharanjeet Kaur - 1 year ago 74
Android Question

How to hide the soft navigation bar(virtual buttons) of android device for whole application?

I want to hide the soft navigational bar i.e. virtual buttons of android device for whole app. I have used below code snippet

getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_IMMERSIVE

to hide it but when i slide gridview it will become visible .

Answer Source

Immersive flag for setSystemUiVisibility() lets your app go truly "full screen." Link

Try below code, for immersive mode.

public void onWindowFocusChanged(boolean hasFocus) {
if (hasFocus) {
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download