我正在创建一个按钮,我可以在我的平板电脑上隐藏或显示状态栏。
我已经投入了onCreate
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
和按钮
显示:
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setAttributes(attrs);
隐藏:
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setAttributes(attrs);
任何提示/提示?
//编辑
private void hideStatusBar() throws IOException, InterruptedException {
Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"});
proc.waitFor();
}
private void showStatusBar() throws IOException, InterruptedException {
Process proc = Runtime.getRuntime().exec(new String[]{"am","startservice","-n","com.android.systemui/.SystemUIService"});
proc.waitFor();
}
所以如果我点击我的按钮一个方法被称为我可以看到,事情正在发生,因为该应用程序等待几秒钟。
我也看了一下LockCat,看到有事情发生了。