I'm using selector to change textview color when user touch it. But the color is permanently black and not changing when touch. Here is my code :
@color/red.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false" android:color="#ffffff" />
<item android:state_focused="true" android:state_pressed="true" android:color="#ffffff" />
<item android:state_focused="false" android:state_pressed="true" android:color="#ffffff" />
<item android:color="#000000" />
textview :
<TextView
android:id="@+id/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="59dp"
android:layout_y="449dp"
android:text="Delete"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/red"
android:textSize="20dp" />
Solution : Use setOnClickListener() for textview instead of setOnTouchListener().