在activity中
getWindow();addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
或在view中
View.setKeepScreenOn(boolean)