如何更改preferenceScreen中每个项目的布局

时间:2016-08-29 21:43:05

标签: android android-layout android-preferences

我是Android开发的初学者,想要设计一个应用程序,允许用户更改preferenceScreen中每个项目的字体大小。我准备了三种不同的布局资源,,并为每个项目添加属性“layout” “EditPreference”“CheckBoxPreference”“ListPreference”。

我想使用 LisPreference 来负责调整font_size以更改每个项目的布局资源。

以下是Preference.XML的代码:

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
    android:key="@string/preference_pers_info"
    android:title="@string/pref_title_userInfo">
    <EditTextPreference
        android:key="@string/preference_user_name"
        android:title="@string/pref_title_userName"
        android:summary="@string/pref_sum_userName"
        android:defaultValue="@string/pref_deVel_userName"
        android:layout="@layout/menu_big_font_size"/>
    <EditTextPreference
        android:key="@string/font_size"
        android:title="@string/pref_title_gridDensity"
        android:summary="@string/pref_sum_gridDensity"
        android:defaultValue="10"
        android:layout="@layout/menu_big_font_size"/>
</PreferenceCategory>

Here's the three layout XML i wrote

intend to change through this way

所以我不知道如何通过使用首选项本身来切换不同的预定义布局资源。希望有一个好的教训! Thx提前!!!

0 个答案:

没有答案
相关问题