Android: Specify two different images for togglebutton using XML
Android: Specify two different images for togglebutton using XML
Specify two different images for togglebutton using XML:
Although, the toggle button will show the starting item in the selector that it matches, so atlast the default should be there. Sequence the item to confirm that they will all be utilized by the following manner,
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:state_pressed="true" /> //currently pressed turning the toggle on <item android:state_pressed="true" /> //currently pressed turning the toggle off <item android:state_checked="true" /> //not pressed default checked state <item /> //default non-pressed non-checked </selector>