`
daikainan
  • 浏览: 200642 次
  • 性别: Icon_minigender_1
  • 来自: 郑州
社区版块
存档分类
最新评论

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);
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics