This can be done solely with XML in 3 steps.
First, create a stateful drawable that can change according to whether the widget using it is enabled, disabled, etc. So statelist_example.xml kept in the drawable folder:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/expander_ic_minimized"
android:state_enabled="true" />
<item
android:drawable="@drawable/expander_ic_minimized_faded"
android:state_enabled="false" />
</selector>
Then define your own layout to use this drawable in the layouts folder. This will become the "widgetLayout" for the Preference. So layout_example.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+android:id/widget_frame"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/icon"
android:src="@drawable/statelist_example"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dip"
android:layout_marginRight="6dip"
android:layout_gravity="center" />
</LinearLayout>
Third, specify the widgetLayout in every preference to use this layout:
<Preference
android:key="preference_example"
android:title="@string/preference_title"
android:widgetLayout="@layout/layout_example" />
So basically you have your Preference reference a Layout which references a stateful drawable.
Android Docs on Statelist Drawable.
Android Docs on Preference widgetLayout.