public void setBrightness(int level) {
ContentResolver cr = getContentResolver();
Settings.System.putInt(cr, "screen_brightness", level);
Window window = getWindow();
LayoutParams attributes = window.getAttributes();
float flevel = level;
attributes.screenBrightness = flevel / 255;
getWindow().setAttributes(attributes);
本文介绍了一种在Android设备上设置屏幕亮度的方法。通过使用ContentResolver和Settings.System类,可以将屏幕亮度设置为指定级别。此外,还展示了如何通过修改窗口属性来调整屏幕亮度。
5674

被折叠的 条评论
为什么被折叠?



