如何增加首选项类别的文本大小

时间:2016-10-12 04:41:33

标签: android preferenceactivity

我想以编程方式增加首选项类别标题的大小,以便如何做到这一点?

下面的

是我的xml

<PreferenceCategory android:title="@string/languagetitle"
    android:key="LanguageCategory">
    <ListPreference
        android:defaultValue="@string/defaultlanguagevalue"
        android:entries="@array/language"
        android:entryValues="@array/languagevalues"
        android:key="language"
        android:summary="@string/languageSubtitle"
        android:title="English" /></PreferenceCategory>
<PreferenceCategory android:title="@string/Notificationtitle"
    android:key="NotificationCategory">
    <SwitchPreference
        android:defaultValue="true"
        android:key="notification"
        android:summary="@string/NotificationSubtitle"
        android:title="@string/Notificationcontent" />
    <ListPreference
        android:entries="@array/time"
        android:entryValues="@array/time"
        android:key="time"
        android:summary="@string/NotificationSubtitleTime"
        android:title="@string/NotificationcontentTime"
        android:defaultValue="9am"
        />
</PreferenceCategory>

<PreferenceCategory
    android:title="@string/FontTitle"
    android:key="FontStyleCategory"
    >
    <faisal.home.com.tafaqquhfiddin.FontStylePreference
        android:key="fontstyle"
        />
    <faisal.home.com.tafaqquhfiddin.FontSizePreference
        android:key="fontsize"
        />

</PreferenceCategory>

<PreferenceCategory
android:title="@string/OTHERS"
android:key="FontSizeCategory">
<faisal.home.com.tafaqquhfiddin.About_us_Preference/>
</PreferenceCategory>

</PreferenceScreen>

以下是我的代码,我希望以编程方式增加其大小

 public void OnLanguageChange()
    {
   SharedPreferences sharedPreferences= PreferenceManager.getDefaultSharedPreferences(getActivity());

       PreferenceCategory languageCategory =(PreferenceCategory) findPreference("LanguageCategory");
       Preference language =findPreference(MyAppManager.LANGUAGE_KEY);
       PreferenceCategory notificationCategory =(PreferenceCategory) findPreference("NotificationCategory");
       Preference notification =findPreference(MyAppManager.NOTIFICATION_KEY);
       Preference notificationTime =findPreference(MyAppManager.NOTIFICATION_TIME_KEY);

        PreferenceCategory fontStyleCategory=(PreferenceCategory)findPreference("FontStyleCategory");
        PreferenceCategory fontSizeCategory=(PreferenceCategory)findPreference("FontSizeCategory");

        languageCategory.setTitle(getString(R.string.languagetitle));
        language.setSummary(getString(R.string.languageSubtitle));

        notificationCategory.setTitle(getString(R.string.Notificationtitle));

        notification.setTitle(getString(R.string.Notificationcontent));
        notification.setSummary(getString(R.string.NotificationSubtitle));

        notificationTime.setTitle(getString(R.string.NotificationcontentTime));
        notificationTime.setSummary(getString(R.string.NotificationSubtitleTime)+" "+ sharedPreferences.getString(MyAppManager.NOTIFICATION_TIME_KEY, "9am"));

        fontStyleCategory.setTitle(getString(R.string.FontTitle));
        fontSizeCategory.setTitle(getString(R.string.FontSize));
}

我是android新手。请帮助我如何实现这个

0 个答案:

没有答案
相关问题