Android

Android 螢幕亮度與背光亮度 調整

screenBrightness只能設置0.0~1.0f之間的數值

val wmlp = window.attributes as WindowManager.LayoutParams
wmlp.screenBrightness = 1.0f
window.attributes = wmlp

保持螢幕常亮

//添加
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
//移除
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

發表迴響