android: How to change ListPreference title colour?

前端 未结 2 845
我在风中等你
我在风中等你 2021-01-02 14:49

I would like to change the title and line color of my ListPreference from blue to pink, to match the line of my action bar.

相关标签:
2条回答
  • 2021-01-02 15:17

    Ended up creating a custom ListPreference widget, following this answer.

    I hoped to be able to simply change the style without having to implement a custom widget, but I haven't figured that out yet.

    0 讨论(0)
  • 2021-01-02 15:39

    Had the same problem today. Old thread, but I found this: and it works perfectly.

    Simply modify your styles.xml

    <resources>
    
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    
        <!-- Add this -->
    
        <item name="android:dialogTheme">@style/DialogStyle</item>
        <item name="android:alertDialogTheme">@style/DialogStyle</item>
    
    </style>
    
    <!-- Customize your color here -->
    
    <style name="DialogStyle" parent="android:Theme.Material.Dialog">
        <item name="android:colorAccent">@color/colorAccent</item>
    </style>
    

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