标签:
int getScreenBrightness(Activity activity) { int value = 0; ContentResolver cr = activity.getContentResolver(); try { value = Settings.System.getInt(cr, Settings.System.SCREEN_BRIGHTNESS); } catch (SettingNotFoundException e) { } return value; }
void setScreenBrightness(Activity activity, float value) { WindowManager.LayoutParams params = activity.getWindow().getAttributes(); params.screenBrightness = value; activity.getWindow().setAttributes(params); }
screenBrightness 的取值范围在[0,1]之间。
标签:
原文地址:http://www.cnblogs.com/yydcdut/p/4240486.html