How to Hide System Navigation Bar in Tablets?

后端 未结 9 1685
一整个雨季
一整个雨季 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:44

    As other people say use the command "pm disable com.android.systemui" in root mode, so the following code execute this command in your android app, just call the following method, your tablet needs to be rooted.

    private void hideNavigationBar(){
            try {
                Process process = Runtime.getRuntime().exec("su");
                DataOutputStream os = new DataOutputStream(process.getOutputStream());
                os.writeBytes("pm disable com.android.systemui\n");
                os.flush();
                os.writeBytes("exit\n");
                os.flush();
                process.waitFor();
                //////////////////////////////////////
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    

    This code hide the navigation bar on the android system, to reappear system bar use "pm enable com.android.systemui" instead of "pm disable com.android.systemui" in the previous code.

提交回复
热议问题