與系統的亮度沒有關聯
若要調整系統亮度的寫法
因需要系統權限,app需sign key
則會另開一篇文章分享
//=====================================
螢幕亮度的值為0-255
import android.view.WindowManager; private void setBrightnessLevel(final int brightness_level) { WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.screenBrightness = Float.valueOf((brightness_level) * (1f / 255f)); getWindow().setAttributes(lp); }