您的位置:首页 > 移动开发 > Android开发

工模-控制屏幕亮度

2016-12-19 14:54 239 查看
在工模测试中有一项测试为LCD屏幕亮度测试,可以通过写值的方式来实现。

// bright 为0~255之间的常量值
private void setBrightness(int bright) {
Window localWindow = getWindow();
WindowManager.LayoutParams localLayoutParams = localWindow
.getAttributes();
//调节屏幕亮度
localLayoutParams.screenBrightness = (bright / 255.0F);
localLayoutParams.buttonBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF;
localWindow.setAttributes(localLayoutParams);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息