Search code examples
androidactionbarsherlockandroid-preferencesandroid-2.3-gingerbread

Icons not showing in SherlockPreferenceActivity on GingerBread (2.3)


I have an app that uses ActionBarSherlock and I have a Preference screen that extend off of SherlockPreferenceActivity:

public class SettingsActivity extends SherlockPreferenceActivity 

My preference XML looks something like:

<Preference
    android:icon="@drawable/settings_prefs_call_settings"
    android:key="pref_btn_call_settings"
    android:summary="Change call settings"
    android:title="Call Settings" />

<Preference
    android:icon="@drawable/call_settings_prefs_my_phone_number"
    android:key="pref_btn_my_phone_number"
    android:summary="Change settings relating to your phone number"
    android:title="My Phone Number" />

When I run this on Android 2.3, the icons (@drawable/call_settings_prefs_my_phone_number and @drawable/settings_prefs_call_settings) never show on the preference screen but show up fine on ICS and JB.

Can anyone tell me how I can get the icons to show up on GB?


Solution

  • Preferences's icon is only supported by Api 11+.So is ActionBarSherlock.