第一种方法
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
?
第二种方法
?
<uses-permission android:name="android.permission.WAKE_LOCK" />
?
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); // in onResume() callmWakeLock.acquire(); // in onPause() call mWakeLock.release();
?