How to change color of the text in TextView on hover like in css with selector? I know for button to define selector with items
<item
android:drawable="@drawable/down"
android:state_pressed="true"
android:state_enabled="true">
</item>
<item
android:drawable="@drawable/up"
android:state_focused="true"
android:state_enabled="true">
</item>
but I need for TextView textColor, but item doesn’t recognize that attribute. Is there way to do this from xml and not from code
?
Add that selector as a resource file (
res/color/text_color.xml)And use it: