Android ImageButton with a selected state?
Posted
by Joren
on Stack Overflow
See other posts from Stack Overflow
or by Joren
Published on 2010-04-09T01:45:22Z
Indexed on
2010/04/09
1:53 UTC
Read the original article
Hit count: 1497
If I was using an ImageButton with a selector for its background, is there a state I can change which will make it change its appearance? Right now I can get it to change images when pressed, but there seems to be no "highlighted" or "selected" or similar state which lets me toggle it's appearance at will.
Here's my XML, it only changes appearance when pressed.
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/map_toolbar_details_selected" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/map_toolbar_details_selected" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/map_toolbar_details_selected" />
<item android:drawable="@drawable/map_toolbar_details" />
© Stack Overflow or respective owner