【发布时间】:2013-04-02 13:11:06
【问题描述】:
我需要在我的应用程序中显示和隐藏系统栏,因此我使用了两个按钮。我曾经测试过 Android (3.0.1) 和 Android (4.1.1) 设备。对于 Android (3.0.1),我可以根据我的要求隐藏和显示系统栏。但在 Android (4.1.1) 中,按钮无法隐藏和显示系统栏。
我的代码是
// Showing system bar
showSystemBarBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
Process proc = Runtime.getRuntime().exec(new String[]{"am","startservice","-n","com.android.systemui/.SystemUIService"});
proc.waitFor();
} catch(Exception e) {
e.printStackTrace();
}
}
});
// Hiding System bar
hideSystemBarBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"});
proc.waitFor();
} catch(Exception e){
e.printStackTrace();
}
}
});
我该如何解决这个问题?
【问题讨论】:
-
两个设备都植根了吗?
-
为什么你使用运行时实现它,而不是stackoverflow.com/questions/6872376/… 变体?
-
是的,两个设备都已root
标签: android performance statusbar android-notifications android-theme