返回顶部

收藏

Android 调节屏幕亮度代码

更多
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); 
} 

标签:java

收藏

0人收藏

支持

0

反对

0

发表评论