android 设置当前应用窗口的屏幕亮度
只针对当前应用窗口,不影响系统屏幕亮度的设置
?
原文解释
?
?This can be used to override the user's preferred brightness of
? the screen.? A value of less than 0, the default, means to use the
? preferred screen brightness.? 0 to 1 adjusts the brightness from
? dark to full bright.
?
我Google 翻译的
?
这可以被用来覆盖用户的首选亮度在屏幕上。值小于0时,默认情况下,意味着使用
首选的屏幕亮度。 //背光的亮度的设置WindowManager.LayoutParams lp = getWindow().getAttributes();if(viewModel.getScreenMode()==Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC){lp.screenBrightness = -1.0f;}else{lp.screenBrightness = viewModel.getScreenBrightness()/255f;}getWindow().setAttributes(lp);?