也许你可以尝试使用下面的代码片段来显示/隐藏有根 android 设备上的状态栏。我已经在 4.2.2 和 4.4.2 上成功测试过这个。祝你好运:)
隐藏:
Process proc = null;
String ProcID = "79"; //HONEYCOMB AND OLDER
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
ProcID = "42"; //ICS AND NEWER
}
try {
proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "service call activity "+ProcID+" s16 com.android.systemui" });
} catch (Exception e) {
Log.w("Main","Failed to kill task bar (1).");
e.printStackTrace();
}
try {
proc.waitFor();
} catch (Exception e) {
Log.w("Main","Failed to kill task bar (2).");
e.printStackTrace();
}
以显示:
Process proc = null;
try {
proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "am startservice -n com.android.systemui/.SystemUIService" });
} catch (Exception e) {
Log.w("Main","Failed to kill task bar (1).");
e.printStackTrace();
}
try {
proc.waitFor();
} catch (Exception e) {
Log.w("Main","Failed to kill task bar (2).");
e.printStackTrace();
}