Develop/Android

EditTextPreference AlertDialog Theme 설정하기

자바칩 2018. 11. 12. 22:52

 App의 기본 스타일을 어두운 테마로 잡아서 Text Color를 #fff로 설정하여 사용하던중


Preference Fragment의 EditTextPreference 에서 문제가 발생했다.



EditTextPreference를 눌렀을 때 나오는 Dialog의 Title과 버튼의 TextColor도 #fff로 되어버렸다.


해결은 아래와 같다


1
2
3
4
5
6
7
8
9
10
11
12
13
14
<resources>
 
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="android:windowBackground">@color/colorBackDark</item>
        <item name="android:textColor">#fff</item>
        <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
        <item name="alertDialogTheme">@style/Base.Theme.AppCompat.Dialog.Alert</item>
    </style>
 
</resources>
cs


alertDialogTheme에 Style을 설정해주면 된다.