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.LayoutParams
lp=getWindow().getAttributes();
lp.screenBrightness=light;
getWindow().setAttributes(lp);
}