Friday, 27 September 2013

Change style of XML defined SharedPreferences Activity, to match newer Holo style

Change style of XML defined SharedPreferences Activity, to match newer
Holo style

I have an existing Preference Activity (created using the standard XML
style, and calling with the Preferences intent).
My problem, is this looks like the old style (2.3) preferences, even on
4.0+ devices. I would like it to look like the newer settings style. Is
there some way to make this appearance change (perhaps applying a specific
style attribute or something)?
I launch the Activity (note: using ApplicationContext, which I think is
correct), in the following manner:
final Context cxt = this.getApplicationContext();
final Intent i5 = new Intent(cxt, Preferences.class);
startActivity(i5);
The XML is:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="@string/pref_notification_time" >
<com.wolfsoft.dotd.util.TimePickerPreference
android:defaultValue="07:30"
android:key="notif_time"
android:summary="@string/summary_notif_time"
android:title="@string/title_notif_time" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_notif_onoff" >
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_pref"
android:summary="@string/summary_notif_preference"
android:title="@string/title_notif_preference" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_notif_category" >
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_game_pref"
android:summary="@string/pref_game_notif_sum"
android:title="@string/pref_game_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_business_pref"
android:summary="@string/pref_business_notif_sum"
android:title="@string/pref_business_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_entertainment_pref"
android:summary="@string/pref_entertainment_notif_sum"
android:title="@string/pref_entertainment_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_lifestyle_pref"
android:summary="@string/pref_lifestyle_notif_sum"
android:title="@string/pref_lifestyle_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_personalization_pref"
android:summary="@string/pref_personalization_notif_sum"
android:title="@string/pref_personalization_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_local_pref"
android:summary="@string/pref_local_notif_sum"
android:title="@string/pref_local_notif_sum_title" />
</PreferenceCategory>
</PreferenceScreen>
My current screen looks like this:
I would like it to look like this: