Pergunta

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.

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top