【问题标题】:Change color of preference header list更改首选项标题列表的颜色
【发布时间】:2012-04-17 10:00:03
【问题描述】:

我正在为具有特定配色方案的 android 4.0 平板电脑创建应用程序。我正在使用 Theme.Holo 进行我的活动。我将 Theme.Holo.Light 用于我的 PreferenceActivity。我已经能够使用样式自定义操作栏。我使用 onBuildHeaders 方法创建首选项标题列表,并将不同的首选项分组到片段中(很像 android 系统设置)。我还想更改标题列表元素的颜色以匹配我的应用程序配色方案,但我无法弄清楚如何。请click on the link查看我的偏好活动。

是否可以更改此配色方案以及如何更改?

【问题讨论】:

标签: android android-layout


【解决方案1】:

首选项标头使用listViewStyle xml 属性来确定其样式。如果您想对其进行自定义,请使用您自己的样式覆盖该设置。例如:

themes.xml

<style name="Theme.Custom" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:listViewStyle">@style/MyListViewStyle</item>
</style>

styles.xml

<style name="MyListViewStyle" parent="@android:style/Widget.Holo.Light.ListView">
    <item name="android:background">@color/custom_color</item>
    <item name="android:listSelector">@drawable/my_selector</item> 
</style>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-02
    • 1970-01-01
    • 2017-09-19
    • 2015-11-17
    • 1970-01-01
    • 2016-06-05
    相关资源
    最近更新 更多