**有没有什么方法可以让我们在整个应用程序中始终保持屏幕状态,但是在一段时间之后它应该变暗,一旦我们触摸就会再次唤醒,请帮助它 提前致谢
答案 0 :(得分:0)
试试这段代码:
WindowManager.LayoutParams params =
getWindow().getAttributes();
params.flags |= LayoutParams.FLAG_KEEP_SCREEN_ON;
params.screenBrightness = YourValue;
getWindow().setAttributes(params);
答案 1 :(得分:0)
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Tag");
wl.acquire();
//..screen will stay on during this section..
wl.release();
不要忘记许可,请在下次谷歌搜索.... http://developer.android.com/reference/android/os/PowerManager.html