How to Hide System Navigation Bar in Tablets?

后端 未结 9 1604
一整个雨季
一整个雨季 2020-11-27 04:13

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 foll

相关标签:
9条回答
  • 2020-11-27 04:59
    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);
    }
    
    0 讨论(0)
  • 2020-11-27 05:02

    Since the system bar is used to navigate in android there is not an easy way to achieve this, you can dissable/dim the controls:

    View v = findViewById(R.id.view_id);
    v.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
    

    But you can get the size of the screen without the systembar (not sure from what version, I think 3.1)

    Method rawW = Display.class.getMethod("getRawWidth");
    Method rawH = Display.class.getMethod("getRawHeight");
    int width = (Integer)mGetRawW.invoke(dp);
    int height = (Integer)mGetRawH.invoke(dp);
    

    If your app has root access there is also a way to achieve it: http://ppareit.github.com/HideBar/

    0 讨论(0)
  • 2020-11-27 05:04

    You can't hide it but you can simply disable it, except home. Try this link. . Using SYSTEM_UI_FLAG_LOW_PROFILE you can dim your system bar and using onWindowFocusChanged() can take the focus and collapse it.

    0 讨论(0)
提交回复
热议问题