增加CheckboxPreference标题和摘要文本大小以及首选项条目的发光

san*_*ana 4 android android-preferences checkboxpreference listpreference

嗨,我正在处理消息设置作为首选项.

我想改变android:title和android:CheckboxPreference的摘要文本字体大小.

在此输入图像描述

为此,我正在尝试下面的代码

   <PreferenceCategory
    android:key="prefcategory1"
    android:title="GENERAL SETTINGS..." >

    <CheckBoxPreference
        android:defaultValue="false"
        android:enabled="true"
        android:key="checkBoxdelete"
        android:layout="@layout/mylayout"     <!--linking it to mylayout.xml -->
        android:summary="Deletes old messages as limits are reached"
        android:title="Delete old messages" />
  </PreferenceCategory>
Run Code Online (Sandbox Code Playgroud)

mylayout.xml

<TextView android:id="@+android:id/title"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:paddingLeft="8dp"
    android:textColor="#FFFFFF"
    android:textSize="30px"
    android:textStyle="bold"/>  

<TextView android:id="@+android:id/summary"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:paddingLeft="8dp"
    android:textColor="#FFFFFF"
    android:textSize="20px"
    android:textStyle="bold"/>
Run Code Online (Sandbox Code Playgroud)

通过使用它,文本大小增加,如下面的屏幕截图.但是,我无法看到复选框..如何解决这个问题?

在此输入图像描述

bha*_*arc 8

当有更简单的方法可以做到时,这里的大多数答案都是完全错误或太复杂.

只为未来的读者 - 你可以改变textSize/ textColor 你的styles.xml

   <style name="PreferencesTheme" parent="@android:style/Theme.Black">
            <item name="android:textSize">34sp</item>
            <item name="android:textColorSecondary">#000000</item>
            <item name="android:textColorPrimary">#000000</item>
    </style>
Run Code Online (Sandbox Code Playgroud)

哪里textColorPrimary会改变checkBoxPreference标题的颜色,并textColorSecondary会改变摘要的颜色.


小智 -1

您的摘要占用了复选框的空间。

尝试在限制后添加“<br/>”

或减小字体大小

或者您可以显式设置 textView 的宽度或高度。