Android 偏好类别样式 [英] Android Preference Category Styling
本文介绍了Android 偏好类别样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试更改首选项类别的文本颜色和背景.我在网上搜索了答案,但似乎没有任何效果.有人成功更改了偏好类别属性的颜色吗?我可以使用自定义布局来更改首选项类别的外观吗?我需要更多的方向.请帮忙
I am trying to change the color of the text and the background of the preference categories. I searched the webs for answers, but nothing seems to be working. Has anyone successfully changed the color of the preference category attributes? Could I use a custom layout to change looks and feel of the preference category? I need some more direction. Please help
这是我目前所拥有的:
<style name="Theme" parent="@style/android:Theme.Holo.Light">
<item name="android:actionBarStyle">@style/ActionBar</item>
</style>
<style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">@color/ab_grey</item>
</style>
<style name="PrefCatStyle" parent="Theme">
<item name="android:textColor">@color/text_green</item>
<item name="android:background">@color/pref_back</item>
</style>
颜色
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ab_grey">#adadad</color> <!-- #adadad-->
<color name="text_green">#000000</color>
<color name="pref_back">#FFFFFF</color>
</resources>
我的偏好布局的一部分
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Settings"
android:key="settings_category"
style="@style/PrefCatStyle">
我的部分清单
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/Theme" >
...
<activity
android:name=".SettingsPrefActivity"
android:parentActivityName=".MainActivity"
android:theme="@style/emTextTheme">
谢谢
推荐答案
是的.您可以使用自定义布局.看看这个问题的答案.自定义 PreferenceCategory 标题
yes. you can use custom layout. take a look at the answer of this question. Custom PreferenceCategory Headings
这篇关于Android 偏好类别样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文