ListPreference text color

前端 未结 2 1575
面向向阳花
面向向阳花 2021-01-24 14:09

I\'m having a hard time trying to style a ListPreference.

I\'ve applied a main theme which declares a preferenceTheme and both of them link to a dialogTheme (and alertD

相关标签:
2条回答
  • 2021-01-24 14:43

    Also for radio buttons color add <item name="colorAccent">#000000</item> to your style. Be careful, it's not android:colorAccent but colorAccent

    0 讨论(0)
  • 2021-01-24 14:49

    You did everything right, except one thing: do not use the android prefix when overriding textColorAlertDialogListItem because this is not the framework version of AlertDialog.

    This statement is generally true for almost all attributes that belong to the support widgets / views. The reason is pretty straightforward: not all attributes are available on the older platforms. Such example is android:colorControlActivated which was introduced in API 21. The AppCompat lib declares its own colorControlActivated so it's available on older API levels, too. In this case the developer should not use the android prefix when defining the style in the theme as that would point to the platform version of the attribute instead of the AppCompat one.

    TL;DR: Do not use the android prefix for support widgets unless you have to (i.e. you get compilation error).


    P.S.: I have created a fix / extension to the support preferences-v7 lib's annoying things that you might want to check out.

    0 讨论(0)
提交回复
热议问题