工模-控制屏幕亮度

来源:互联网 发布:大学毕业后悔做程序员 编辑:程序博客网 时间:2024/05/02 02:04

在工模测试中有一项测试为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);    }
0 0