[英]Android screen brightness Max Value?
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
I added this code to button onClick and it worked !我将此代码添加到按钮 onClick 并且它起作用了! But is there a higher value since the screen didn't light MAX ??
但是因为屏幕没有点亮 MAX ,所以有更高的值吗??
As stated in the documentation , no. 如文档中所述,没有。 Setting
screenBrightness
to 1 should adjust the brightness to full light.将
screenBrightness
设置为 1 应将亮度调整为全光。
You should be able to set the value as 1L and it should go to max brightness as this is the max brightness您应该能够将值设置为 1L 并且它应该达到最大亮度,因为这是最大亮度
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = 1F;
getWindow().setAttributes(layout);
Will set it to max brightness..将其设置为最大亮度..
You should disable screen dimming first before you set the brightness, or you may get a less than MAX brightness !在设置亮度之前,您应该先禁用屏幕调光,否则您可能会获得低于 MAX 的亮度! Try something like this before you set the brightness:
在设置亮度之前尝试这样的事情:
// 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");
You Use this code您使用此代码
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);
A full example shows how to change brightness by coding, foreground, background.一个完整的例子展示了如何通过编码、前景、背景来改变亮度。 brightnessdemo
亮度演示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.