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

当有更简单的方法可以做到时,这里的大多数答案都是完全错误或太复杂.
只为未来的读者 - 你可以改变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会改变摘要的颜色.
| 归档时间: |
|
| 查看次数: |
3768 次 |
| 最近记录: |