How to add icons to PreferenceScreen entries
I have another suggestion which works for me on my Nexus 7, running Android 4.2, and my ASUS TF101, running Android 4.0.3: add the icon attribute to the preference headers, like so:
<?xml version="1.0" encoding="utf-8"?>
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >
<header
android:fragment="com.example.SettingsFragment"
android:summary="@string/pref_summary_caching"
android:icon="@drawable/ic_pref_cache"
android:title="@string/pref_cat_caching" >
<extra
android:name="category"
android:value="caching" />
</header>
</preference-headers>
this lets the icons appear to the left of the header text. Seems to be documented nowhere, and you cannot enter the values through the Structure screen of the XML editor, as there does not seem to be an XML schema for the preference-headers file. But hey, it WORKS!
Use android:icon
http://developer.android.com/reference/android/preference/Preference.html#attr_android:icon
You can look at the source code to the settings app and see they they are extending Preference
to do this. Here is the class file.
https://github.com/android/platform_packages_apps_settings/blob/master/src/com/android/settings/IconPreferenceScreen.java
hope this helps!