添加屏幕亮度控制到Android应用 [英] Adding screen brightness controls to android application

查看:110
本文介绍了添加屏幕亮度控制到Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待将控件添加到我的应用程序菜单中局部调整屏幕亮度,但似乎无法弄清楚如何做到这一点。我见过的例子来最大输出或暗淡的亮度,但我期待添加控件,以便用户可以控制和设置亮度级别。没有人有任何的例子,教程,源$ C ​​$ C,或只是一个地方点我在正确的方向?

I am looking to add controls to adjust screen brightness locally in my app menu but can't seem to figure out how to do it. I have seen examples to max-out or dim brightness but I am looking to add controls so that the user can control and set the brightness level. Does anyone have any examples, tutorials, source code, or just a place to point me in the right direction?

推荐答案

<一个href="http://almondmendoza.com/2009/05/23/changing-the-screen-brightness-programatically-in-cupcake/">The互联网声称这个作品,我还没有尝试过,但:

The internet claims this works, I haven't tried it though:

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

这篇关于添加屏幕亮度控制到Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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