当前位置: 代码迷 >> Android >> android 设立当前应用窗口的屏幕亮度
  详细解决方案

android 设立当前应用窗口的屏幕亮度

热度:59   发布时间:2016-05-01 15:22:27.0
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时,默认情况下,意味着使用
首选屏幕亮度 0到1调整亮度全亮

?

?

//背光的亮度的设置		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);
?
  相关解决方案