禁用时,首选项背景和标题不会显示为灰色

时间:2017-06-25 09:01:32

标签: android android-preferences

我的PreferenceScreen有一些自定义偏好设置。

自定义首选项在xml中使用以下行定义:

android:dependency="@string/Settings_main_pref_key"

密钥Settings_main_pref_key的偏好设为SwitchPreference

自定义首选项是带标题和搜索栏的首选项,其布局如下:

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="6sp"
    android:layout_marginLeft="16sp"
    android:layout_marginRight="6sp"
    android:layout_marginTop="6sp" >

    <TextView
        android:id="@+android:id/title"
        android:layout_width="120dp"
        android:layout_height="wrap_content"
        android:inputType="none"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#000000"
        android:textSize="15sp"
         />

    <TextView android:id="@+android:id/summary"
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_below="@android:id/title" 
        android:maxLines="2"
        android:layout_width="wrap_content" />

</RelativeLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="6sp"
    android:layout_marginLeft="6sp"
    android:layout_marginRight="6sp"
    android:layout_marginTop="10sp"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:weightSum="1" >


    <SeekBar
        android:id="@+id/change_seekbar"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.9"
        android:paddingLeft="20dip"
        android:paddingRight="20dip"
         >

    </SeekBar>

    <TextView
        android:id="@+id/Text_Box_seek"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="5dip"
        android:maxWidth="70dp"
        android:textSize="13sp" >

    </TextView>
</LinearLayout>

问题是,当关闭开关首选项时,只有标题Text_Box_seek的搜索栏和文本视图会像它们应该一样变灰,但首选项的标题及其背景不会改变颜色......为什么会这样?

0 个答案:

没有答案
相关问题