在解除ProgressDialog后点亮屏幕

时间:2012-08-22 08:56:49

标签: android android-layout

我有一项活动,我正在使用ProgressDialog。

执行dialog.dismiss()后,屏幕保持灰色,直到用户按下屏幕然后亮起。

如何在dialog.dismiss()命令后点亮屏幕?

1 个答案:

答案 0 :(得分:0)

int brightnessMode = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE);
if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
    Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
}

WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.screenBrightness = 0.5F; // set 50% brightness
getWindow().setAttributes(layoutParams);