android - Selector for a drawable within an EditText -
i have edittext drawableend. want change drawable when it's pressed. i've created selector no image visible now. possible in way or maybe i'm doing wrong?
layout
<edittext android:drawableend="@drawable/selector" android:layout_height="wrap_content" android:layout_width="match_parent"/>
selector
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/image_on" android:state_enabled="true" android:state_pressed="true"/> <item android:drawable="@drawable/image_off" android:state_enabled="true"/> </selector>
your selector seems wrong, have declare 1 statement in 1 item. , set 2 items state_enabled="true". needs be:
<item android:drawable="@drawable/pressed_image" android:state_pressed="true"/> <item android:drawable="@drawable/image_on" android:state_enabled="true"/> <item android:drawable="@drawable/image_off" android:state_enabled="false"/>
and, found out since long time, order of statements important. calling wrong order lead no result sometimes....
Comments
Post a Comment