调节屏幕亮度

public void setBrightness(int level) {
  ContentResolver cr = getContentResolver();
  Settings.System.putInt(cr, "screen_brightness", level);
  Window window = getWindow();
  LayoutParams attributes = window.getAttributes();
  float flevel = level;
  attributes.screenBrightness = flevel / 255;
  getWindow().setAttributes(attributes);

}

 

posted @ 2015-12-08 15:41  黑土白云  阅读(151)  评论(0编辑  收藏  举报