WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
我将此代码添加到按钮onClick并且它有效! 但是,由于屏幕没有亮起,因此有更高的值吗?
答案 0 :(得分:6)
As stated in the documentation,不。将screenBrightness
设置为1应将亮度调整为全光。
答案 1 :(得分:1)
你应该可以将值设置为1L,它应该达到最大亮度,因为这是最大亮度
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
将其设置为最大亮度..
答案 2 :(得分:0)
您应该在设置亮度之前先禁用屏幕调光,否则可能会获得低于MAX的亮度!在设置亮度之前尝试这样的事情:
// 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");
答案 3 :(得分:0)
您使用此代码
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);
答案 4 :(得分:0)
完整示例显示了如何通过编码,前景,背景来改变亮度。 brightnessdemo