我想將ListPreference的標題和線條顏色從藍色更改爲粉色,以匹配我的操作欄的行。android:如何更改ListPreference標題顏色?
任何想法?提前致謝!
我一直在尋找Android的themes.xml
和styles.xml
看着像dialogPreferenceStyle
這樣的東西,但還沒弄明白。
我想將ListPreference的標題和線條顏色從藍色更改爲粉色,以匹配我的操作欄的行。android:如何更改ListPreference標題顏色?
任何想法?提前致謝!
我一直在尋找Android的themes.xml
和styles.xml
看着像dialogPreferenceStyle
這樣的東西,但還沒弄明白。
今天有同樣的問題。 舊的線程,但我發現this:,它完美的作品。
只需修改您的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
小部件,請按照this answer。
我希望能夠簡單地改變風格而不必實現自定義小部件,但我還沒有想到。
你收到了嗎?我想改變背景顏色 –
@BhargavKumarR不幸的是,我沒有找到一種方法,沒有創建一個自定義的小工具,下面的鏈接的答案。 – Felix
感謝您的回覆。我花了足夠的時間用某種風格屬性來完成它,但不能。我會嘗試你的解決方案和+1 :) –
不錯,方式更乾淨的解決方案! – Felix