Tuesday, 10 September 2013

Android bg drawable selector state of most recent presed

Android bg drawable selector state of most recent presed

I have a button that is assigned a bg with a selector that controls its bg
drawable ( shown below ). I can't seem to find a state where an item
persist after a button has been pressed. To clarify iam looking for a
state where the current/most recent button pressed can be assigned an
image accordingly.
Does anyone know how this can be done?
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:constantSize="true"
android:dither="false"
android:variablePadding="false">
<item android:drawable="@drawable/option_button_yellow"
android:state_pressed="true"/>
<item android:drawable="@drawable/option_button_yellow"
android:state_focused="true"/>
<item android:drawable="@drawable/option_button_white"/>
</selector>

No comments:

Post a Comment