带有首选项类型样式的Android问题

时间:2014-02-21 16:52:20

标签: android preferenceactivity

我想弄清楚如何将Preference Category标题设置为另一种颜色。我不知道如何改变风格。我看过stackoverflow,我无法让它工作。这就是我所拥有的。它可能不对,但我不确定我需要做什么。

style.xml

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>
    <style name="PreferenceScreenStyle" parent="AppBaseTheme">
        <item name="android:textColor">@color/PrefTitleColor</item>
    </style>
    <color name="PrefTitleColor">#000800</color>
</resources>

preference.xml

<?xml version="1.0" encoding="utf-8"?>

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceCategory 
        android:title="Settings"
        android:key="settings_category"
        style="@style/PreferenceScreenStyle">

        <CheckBoxPreference 
            android:key="test1"
            android:summary="Blah Blah"
            android:title="Blah Blah" 
            android:defaultValue="false"
        />
    </PreferenceCategory>
</PreferenceScreen>

我的清单的一部分

    <activity
        android:name=".SettingsPrefActivity"
        android:theme="@style/PreferenceScreenStyle"
        >
    </activity>

我是否朝着正确的方向前进?

0 个答案:

没有答案