반응형
Holo.Light 테마를 사용하고 pre-honeycomb 장치에서 'Light'로 돌아가는 방법은 무엇입니까?
Holo.Light테마를 지원하는 기기 에서 사용하고 Light다른 기기 에서는 일반 테마로 돌아가고 싶습니다 .
현재 참조 Holo.Light는 3.0 이상에서 잘 작동하지만 이전 API는 단순히 기본 '어두운'테마로 되돌아갑니다. 스타일 상속으로 원하는 것을 얻을 수 있습니까?
최종적으로이 테마를 앱의 기본 테마로 설정하려면 사용자 지정 테마를 만들고 일부 디렉터리에 저장해야합니다.
먼저 값에 다음과 같이 themes.xml을 추가합니다.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Any customizations for your app running on pre-3.0 devices here -->
</style>
</resources>
그런 다음 res 디렉토리에 "values-v11"(Android 3.0 이상)이라는 이름으로 디렉토리를 만들고 다음과 같이 themes.xml을 넣습니다.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on 3.0+ devices here -->
</style>
</resources>
마지막으로 res 디렉토리에 "values-v14"(Android 4.0 이상) 이름으로 디렉토리를 만들고 themes.xml을 만듭니다.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<!-- Any customizations for your app running on 4.0+ devices here -->
</style>
</resources>
DeviceDefault를 사용하면 Android 4 용 맞춤 테마를 추가하는 모든 회사 (HTC Samsung ...)의 모든 기기에서 앱이 항상 완벽하게 보입니다.
편집 : 삼성의 인터페이스 (TouchWiz)는이 기능을 존중하지 않으며 앱은 삼성 기기에서 매우 추악 할 것입니다. 더 나은 Holo 테마를 넣어 :(
마지막으로 manifest.xml에서
<application
...
android:theme="@style/MyAppTheme">
다음과 같이 배경을 흰색으로 설정 한 다음 다른 모든 위젯을 검은 색으로 만들 수도 있습니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
**android:background="#ffffff"
android:orientation="vertical" >
<TextView
android:id="@+id/tvText"
android:text="@string/text"
**android:textColor="#000000"
android:textSize="12dp" />
반응형
'Program Club' 카테고리의 다른 글
| R에서 데이터 프레임의 첫 번째 행을 삭제하는 방법은 무엇입니까? (0) | 2020.10.13 |
|---|---|
| Sass / Compass-16 진수, RGB 또는 명명 된 색상을 RGBA로 변환 (0) | 2020.10.13 |
| 우편 배달부와의 Websocket 연결 (0) | 2020.10.12 |
| C 조건부 전 처리기 지시문에서 문자열을 비교하는 방법 (0) | 2020.10.12 |
| 원자 운영 비용 (0) | 2020.10.12 |