当前位置:首页 » 安卓系统 » android亮度

android亮度

发布时间: 2024-07-19 03:42:37

A. android代码,怎么监控到屏幕亮度的变化

android的屏幕亮度变化时不会发送广播,而是通过Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, value);设置的,其中的参数value是0-255之间的整型值,如果想获取到当前屏幕的亮度的话,可以通过int currentValue=Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);当然获取到的值也是0-255之间的数,如果你想获取到屏幕亮度的变化可以在Settings.System.putInt()方法中找到Settings.System.SCREEN_BRIGHTNESS_MODE对应的设置语句,然后发送一个广播出去。

B. android 应用开发如何调节闪光灯亮度

这是与设备相关的,因为硬件厂商才能自行定义硬件的属性。比如htc为相机闪光灯设置一个亮度文件,通过改写这个文件的值,可以达到变更相机闪光灯的亮度,魅族应该也是这样操作的。作为安卓系统来说,没有统一的解决方案的。

参考htc闪光灯亮度root下的设置方法:
on 2.2 HTC devices you can use it by writing a string to/sys/devices/platform/flashlight.0/leds/flashlight/brightness. This controls if the LED is on and how bright it is. For maximum brightness write "128\n", half brightness write "64\n". Easy to test from adb shell:

C. Android亮度调节的几种实现方法

Android亮度调节分为三个层次,分别是:Android系统亮度调节、Android App亮度调节和Android当前屏幕(Window)亮度调节。
1.Android系统亮度调节
Android系统亮度调节全局性最高,常见于系统设置中的亮度设置项。Android中提供了获取和设置系统亮度值(“手动模式下的亮度值”)的接口,具体如下:
// 获取系统亮度
Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
// 设置系统亮度
Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS,systemBrightness);
2.Android App亮度调节
与系统亮度不同的是,Android中并未直接提供针对于App层面的亮度调节方式。因此,对于需要进行App的亮度调节,可以通过系统亮度调节或当前屏幕的亮度调节方式间接来实现。
3.Android当前屏幕(Window)亮度调节
Android针对当前屏幕(Window)提供了设置亮度的接口,常见写法如下:Window window = activity.getWindow();WindowManager.LayoutParams lp = window.getAttributes();lp.screenBrightness = brightness;window.setAttributes(lp);

热点内容
it固定资产管理系统源码 发布:2025-09-16 00:35:42 浏览:353
Linux是搭建www服务器 发布:2025-09-16 00:35:34 浏览:338
php显示文字 发布:2025-09-16 00:20:25 浏览:280
轻量应用服务器可以搭建网站吗 发布:2025-09-16 00:13:19 浏览:993
压缩机外装 发布:2025-09-15 23:59:46 浏览:450
服务器的狗是什么 发布:2025-09-15 23:20:04 浏览:691
scaletypeandroid 发布:2025-09-15 23:08:27 浏览:636
c语言指针指向数组 发布:2025-09-15 23:04:07 浏览:867
刷妖气封印脚本 发布:2025-09-15 22:59:10 浏览:603
在线抓源码 发布:2025-09-15 22:51:57 浏览:259