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

熱點內容
蘋果訪問限制要打開嗎 發布:2024-10-18 14:26:31 瀏覽:120
php時間數字 發布:2024-10-18 14:26:30 瀏覽:603
qq系統頭像文件夾 發布:2024-10-18 14:14:55 瀏覽:234
安卓手機請輸入密碼在哪裡 發布:2024-10-18 14:13:28 瀏覽:645
設計編譯程序注意的問題 發布:2024-10-18 14:08:43 瀏覽:254
傳智播客android視頻 發布:2024-10-18 14:04:42 瀏覽:904
手機版安卓吃雞哪個好 發布:2024-10-18 14:01:40 瀏覽:491
編程自學入門教程 發布:2024-10-18 13:50:58 瀏覽:141
伊迪阿明訪問中國 發布:2024-10-18 13:49:54 瀏覽:10
人三琳外傳腳本 發布:2024-10-18 13:38:16 瀏覽:839