你怎么能使用搜索栏增加Android的屏幕亮度?你怎么、亮度、屏幕、Android

2023-09-08 09:19:35 作者:尐潴猪ぴ壊壊ヤ

我想加用寻求我的Andr​​oid应用程序中的栏屏幕的亮度,但我不知道如何做到这一点。如何添加此功能?

I would like to increase the brightness of the screen using a seek bar within my Android application, but I'm not sure how to do this. How can I add this functionality?

推荐答案

使用这个你可以设置屏幕亮度:

Using this you can set the screen brightness:

WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 100 / 100.0f;
getWindow().setAttributes(lp);

现在,只要你想实现像控制进度条,我会建议你实现搜索栏,所以使用这个你可以很方便地增加基础上的跟踪搜索栏的值/减小。

Now, as you want to implement progress bar like control, i would suggest you to implement SeekBar, so using this you can easily increase/decrease based on tracking value of seekbar.

这里是实现了完整的例子使用搜索栏。

Here is the full example implemented using the SeekBar.