當前位置:首頁 » 安卓系統 » 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);

熱點內容
c語言sad 發布:2025-10-19 09:21:46 瀏覽:705
initd啟動腳本 發布:2025-10-19 08:53:27 瀏覽:70
本地代碼java 發布:2025-10-19 08:49:28 瀏覽:750
安卓軟體覆蓋設置在哪裡 發布:2025-10-19 08:47:01 瀏覽:950
excel拼sql語句 發布:2025-10-19 08:43:51 瀏覽:342
ip伺服器地址查看埠 發布:2025-10-19 08:43:06 瀏覽:994
免費企業網站php源碼 發布:2025-10-19 08:41:30 瀏覽:614
java正則表達式教程 發布:2025-10-19 08:36:36 瀏覽:726
小型機演算法 發布:2025-10-19 08:16:39 瀏覽:176
如何用c編程 發布:2025-10-19 08:16:03 瀏覽:24