0

I want to increase size of preference categaory title programmatically so how can do this ?

below is my 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>

and below is my code where i want to increase its size programmatically

 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));
}

I am new to android. Please help me how can i achieve this

FaisalAhmed
  • 3,469
  • 7
  • 46
  • 76

0 Answers0