WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
我将此代码添加到按钮onClick中,它起作用了!但是由于屏幕没有亮度最大值,是否存在更高的值?
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
您应该能够将值设置为1L,这样它就会达到最大亮度,因为这是最大亮度。
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
将其设置为最大亮度。
// disable screen dimming (note - this also requires setting in manifest file)
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen");
使用此代码
float SysBackLightValue = 255f;
android.provider.Settings.System.putInt(BatteryBoosterActivity.this.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS,(int) SysBackLightValue);
Window myWindow =BatteryBoosterActivity.this. getWindow();
WindowManager.LayoutParams winParams = myWindow.getAttributes(); winParams.screenBrightness = 255f;
myWindow.setAttributes(winParams);
BRIGHTNESS_OVERRIDE_FULL
。它的值为1.0f。 - Cristan