Is there a way to hide the system/navigation bar in Android ICS

前端 未结 12 1748
面向向阳花
面向向阳花 2020-12-01 01:02

I\'d like to extend the discussion regarding hiding of the system/navigation bar at the bottom of the screen on Android Ice Cream Sandwich (4.0 and up) tablet devices.

12条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 01:26

    If your device is rooted this code will help you to hide system bar on ICS (I tested it on Samsung Galaxy Tab 2 and it works excellent):

    ArrayList list = new ArrayList();
    Map env = System.getenv();
    for (String envName : env.keySet()) {
        list.add(envName + "=" + env.get(envName));
    }
    
    // Array containing the environment to start the new process in
    String[] envp = (String[]) list.toArray(new String[0]);
    
    String hidingCommand = "while [ true ]\n" + "do\n" + "killall com.android.systemui\n" + "done\n";
    Runtime.getRuntime().exec(new String[] { "su", "-c", command }, envp);
    
    myContext.sendBroadcast(new Intent("com.mycompany.myapp.ACTION_BARHIDDEN"));
    

提交回复
热议问题