Selector tag in android -
i working on home screen application, trying changes existing one. downloaded code mydroid folder. , when analyzing found used selector tag in xml file, couldn't understand used achieve functionality.
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false" android:drawable="@drawable/ic_launcher_allshow" /> <item android:state_checked="true" android:drawable="@drawable/ic_launcher_allhide" /> </selector> it present in res/drawable folder.
a selector tag looks state of ui @ time , displays appropriate image.
this particular drawable check box, when checkbox in state
android:state_checked="false" (i.e. when checkbox not checked)
it uses image:
@drawable/ic_launcher_allshow therefore , checked:
android:state_checked="true" uses
@drawable/ic_launcher_allhide see here:
http://developer.android.com/guide/topics/resources/drawable-resource.html#statelist
&
http://developer.android.com/reference/android/graphics/drawable/statelistdrawable.html
Comments
Post a Comment