Skip to content Skip to sidebar Skip to footer

How To Change Color Of The Text In Textview On Hover Like In Css?

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

Solution 1:

Add that selector as a resource file (res/color/text_color.xml)

<?xml version="1.0" encoding="utf-8"?><selectorxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:state_focused="true"android:color="@color/focused_text_color"/><itemandroid:state_pressed="true"android:state_enabled="false"android:color="@color/pressed_text_color" /><itemandroid:state_enabled="false"android:color="@color/disabled_text_color" /><itemandroid:color="@color/default_text_color"/></selector>

And use it:

android:textColor="@color/text_color"

Post a Comment for "How To Change Color Of The Text In Textview On Hover Like In Css?"