티스토리 뷰

Mobile/Android

[Android]화면 밝기 관련

out of coding 2014. 2. 10. 13:19

앱의 권한 설정 필요함

android.permission.WRITE_SETTING


1. 안드로이드 시스템 밝기값 조절

- 안드로이드 자체의 밝기는 0~255 값을 가진다. 시스템설정쪽에 저장되는 값이다.

Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, [int value]);


2. 윈도우 매니저 밝기

- 윈도우 매니저의 밝기는 0.00 ~ 1.00값을 가지며, 100%값을 계산하여서 생각하면 된다.

- 이 부분의 값을 0으로 설정하여 버리게 되면, 화면이 꺼지게 된다.

WindowManager.LayoutParams layoutParams = getWindow().getAttributes();

layoutParams.screenBrightness = [float value];

getWindow().setAttributes(layoutParams);


3. 자동 밝기 조정 모드 상태 확인

- 자동 Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC

- 수동 Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL

Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE);

'Mobile > Android' 카테고리의 다른 글

Hello, Testing  (0) 2014.03.07
Testing in Other IDEs  (0) 2014.03.07
Data backup  (0) 2014.02.19
Testing. Eclipse with ADT  (0) 2014.02.07
Testing. Instrumentation  (1) 2014.02.06
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함