Moblie/Android
andriodStudio/다크 테마 지원하기
zyin
2022. 5. 11. 10:00
문제
어두운 테마는 Android 10 (API 레벨 29) 이상에서 제공된다.
글씨색을 검은색으로 하게 되면 배경 색이 어두울 때 글씨를 알아 볼 수 없다.
1. res/values-night/colors.xml 만들기
values/colors.xml에 추가
<!-- text color -->
<color name="text_color">#FF000000</color>
night/colors.xml에 추가
<!-- text color -->
<color name="text_color">#FF000000</color>
2. styles 커스텀 하기
themes.xml에 추가
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="..." ...>
...
<!-- text style -->
<item name="android:textColor">@color/text_color</item>
</style>
</resources>
night/themes.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="..." ...>
...
<!-- text style -->
<item name="android:textColor">@color/text_color</item>
</style>
</resources>
결과
참고
https://developer.android.com/guide/topics/ui/look-and-feel/darktheme?hl=ko
어두운 테마 | Android 개발자 | Android Developers
어두운 테마 어두운 테마는 Android 10 (API 레벨 29) 이상에서 제공됩니다. 어두운 테마는 다음과 같은 여러 가지 장점이 있습니다. 전력 사용량을 상당히 절약할 수 있습니다(기기 화면 기술에 따
developer.android.com