手记

Android使背景灯(Brightness)高亮的方法

WindowManager.LayoutParams lp=getWindow().getAttributes();
        lp.screenBrightness=1.0f;

LayoutParams的screenBrightness参数是一个百分比0表示最暗,1即100%表示最亮。
这里的1.0f即表示100%,将屏幕背景灯开到最亮。

注意,这个方法只在Android1.5版本才有,之前的版本没有。写出来的apk在HTC G2(magic)上测试通过。

[代码]java代码:

private void SetBright(float light)    {  

      WindowManager.LayoutParamslp=getWindow().getAttributes();

      lp.screenBrightness=light;        

      getWindow().setAttributes(lp);     

}

原文链接:http://www.apkbus.com/blog-792467-60530.html

0人推荐
随时随地看视频
慕课网APP