質問

After Android 3.0 we can add icon to preference using preference.setIcon(icon). how can i add icons to preference to support older versions than Android 3.0? thank you.

役に立ちましたか?

解決

Since Preference.setIcon was only added in API 11, to add icons to preference in older Android versions you could clone the IconPreferenceScreen and then import to you project. You will need to make a few changes to load custom attributes.

After that you can just use the new IconPreferenceScreen in place of a Preference, and add an icon.

IconPreferenceScreen source code

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top