我想将我的 ListPreference 的标题和线条颜色从蓝色更改为粉红色,以匹配我的操作栏的线条。
有任何想法吗?提前致谢!
我一直在浏览 Androidthemes.xml
并styles.xml
查看类似的东西dialogPreferenceStyle
,但还没有弄清楚。
我想将我的 ListPreference 的标题和线条颜色从蓝色更改为粉红色,以匹配我的操作栏的线条。
有任何想法吗?提前致谢!
我一直在浏览 Androidthemes.xml
并styles.xml
查看类似的东西dialogPreferenceStyle
,但还没有弄清楚。
今天遇到了同样的问题。旧线程,但我发现了这个:它工作得很好。
只需修改您的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>
ListPreference
最终按照这个答案创建了一个自定义小部件。
我希望能够简单地更改样式而不必实现自定义小部件,但我还没有弄清楚。