xiaochao1234

设置当前的Activity的屏幕亮度,而不是设置系统的屏幕亮度,退出当前的Activity后恢复系统的亮度。

 

直接看代码好了

 

 

Java代码
  1. WindowManager.LayoutParams lp = getWindow().getAttributes();  
  2. lp.screenBrightness = 0.5f;  
  3. getWindow().setAttributes(lp);  

 

 

screenBrightness的值范围是0到1。

 

注意不要设成0,屏幕会黑掉,完全看不到。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-10-09
  • 2021-10-19
猜你喜欢
  • 2022-12-23
  • 2021-11-11
  • 2021-08-24
  • 2022-12-23
  • 2021-12-26
  • 2021-12-12
相关资源
相似解决方案