Changing the Screen Brightness System Setting Android

前端 未结 4 2008
执念已碎
执念已碎 2020-11-29 21:11

I\'m attempting to change the screen brightness from withing a service, like so:

android.provider.Settings.System.putInt(getContentResolver(),
android.provid         


        
4条回答
  •  执念已碎
    2020-11-29 21:41

    You might have to do it through the Window object.

    For example,

    WindowManager.LayoutParams lp = getWindow().getAttributes();
    
    lp.screenBrightness= lp.screenBrightness*1.25;
    
    getWindow().setAttributes(lp);
    

提交回复
热议问题