你怎么能使用搜索栏增加Android的屏幕亮度? [英] How could you increase the screen brightness in Android using a seek bar?

查看:263
本文介绍了你怎么能使用搜索栏增加Android的屏幕亮度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加用寻求我的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.

这篇关于你怎么能使用搜索栏增加Android的屏幕亮度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆