Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Hide System Navigation Bar in Tablets?

At my Tablet, it has following bar to control back, home etc. (I don't know the correct name, status bar? control bar? Action bar? or other)

In program, it use following method to have a full screen.

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.PROGRESS_INDETERMINATE_OFF);

But I don't know why the bar still in here. Because of it, I can't have the correct screen size.

Who can tell me how to remove it?

The Bar

like image 414
John Avatar asked Sep 26 '12 15:09

John


1 Answers

public class Utils {

public static void hideNavigations(Activity context) {
    View decorView = context.getWindow().getDecorView();
    decorView.setSystemUiVisibility(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);
}

}

In your Activity:

@Override
protected void onResume() {
    super.onResume();
    Utils.hideNavigations(this);
}
like image 103
Andreu Avatar answered Oct 22 '22 01:10

Andreu