3

我想要一个使用 调整屏幕亮度的对话框SeekBar

如何显示SeekBar调整屏幕亮度的自定义对话框?

4

3 回答 3

6

您可以使用此 API。这将改变您的窗口而不是整个系统的屏幕亮度。

        // Make the screen full bright for this activity.
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.screenBrightness = 1.0f;

        getWindow().setAttributes(lp);
于 2011-09-08T04:24:58.987 回答
2

代码段应该可以帮助您

pdlg = ProgressDialog.show(getParent(), "Loading...", ""); 
WindowManager.LayoutParams lp = pdlg.getWindow().getAttributes();
p.dimAmount=0.0f;        //Dim Amount
pdlg.getWindow().setAttributes(lp);  //Applying properties to progress dialog
pdlg.dismiss(); //Dismiss the dialog
于 2011-09-08T06:51:33.173 回答
1

嘿,您可以像这样设置系统亮度:

 //Set the system brightness using the brightness variable value
System.putInt(cResolver, System.SCREEN_BRIGHTNESS, brightness);
//Get the current window attributes
LayoutParams layoutpars = window.getAttributes();
//Set the brightness of this window
layoutpars.screenBrightness = brightness / (float)255;
//Apply attribute changes to this window
window.setAttributes(layoutpars);

或者你可以参考这个完整的教程

于 2015-09-17T03:52:00.900 回答