android - ListView item state color -
i trying change background color of listview during item selection , it's various state. , have wrote markup:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/my_color" android:state_activated="true"/> <item android:drawable="@color/my_color" android:state_selected="true"/> <item android:drawable="@color/my_color" android:state_pressed="true"/> <item android:drawable="@android:color/transparent"/> </selector>
the problem - desied color applied in every state of list item except post selection of listitem. mean when user select , immediate after touch, shows default blue color millisecond. missing handle state?
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/my_color" android:state_enabled="true" android:state_focused="true"/> <item android:drawable="@color/my_color" android:state_enabled="true" android:state_selected="true"/> <item android:drawable="@color/my_color" android:state_enabled="true" android:state_pressed="true"/> <item android:drawable="@android:color/transparent" android:state_enabled="true"/> </selector>
please have try, hope can u.