android电源菜单在哪,Android:显示/隐藏状态栏/电源栏

我正在创建一个按钮,我可以在我的平板电脑上隐藏或显示状态栏。

我已经投入了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,看到有事情发生了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值