简体   繁体   English

改变HTC Sense设备的屏幕亮度

[英]Changing screen brightness on a HTC Sense device

The old approach 旧方法

  Window window = getWindow();
  LayoutParams layoutParams = window.getAttributes();
  layoutParams.screenBrightness = newFloatValue;
  window.setAttributes(layoutParams);

doesn't work on HTC Desire with Automatic brightness checked in Settings > Display > Brightness . “设置”>“显示”>“亮度”中选中 自动亮度”时 ,不适用于HTC Desire。
Is there a HTC-specific workaround for that? 是否有特定于HTC的解决方法?

Of course you don't see any changes since the settings are set to Automatic Brightness . 当然,由于设置设置为“ 自动亮度 ”,因此您看不到任何更改。 That means, any manual changes are disregarded. 这意味着,任何手动更改都会被忽略。 Or am I missing something? 或者我错过了什么?

I've just tested it on a HTC Desire HD (2.3.5) and the screen brightness DOES change for about a second, but then it's immediately re-adjusted/overwritten by the automatic brightness. 我只是测试它在HTC的Desire HD(2.3.5)和屏幕的亮度改变大约一秒钟,但随后会立即重新调整/由自动亮度覆盖。 However, if you uncheck Auto Brightness option in the settings, you can see that the value has changed correctly. 但是,如果取消选中设置中的“自动亮度”选项,则可以看到值已正确更改。

So, imo everything is working as expected. 所以,imo一切都按预期工作。 If you want your changes to take effect you might have to disable Auto Brightness first: 如果您希望更改生效,则可能必须先禁用自动亮度:

Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM