android - Selector on press not working in imageVIew -


i using selector imageview change image on press event. not changing image when press on it.

here selector,

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">  <item     android:state_pressed="true"     android:drawable="@drawable/fed_1" />  <item     android:drawable="@drawable/fed" /> </selector>    

and imageview,

<imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|right" android:src="@drawable/sel_fed" /> 

also tried using background image view it's not working.

you should add android:clickable="true". imageview this

<imageview   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:layout_gravity="center_vertical|right"   android:clickable="true"   android:src="@drawable/sel_fed" /> 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -