把這個文件在res /彩色夾 color_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false"
android:color="@color/skyblue" />
<item android:state_focused="true" android:state_pressed="true"
android:color="@color/white" />
<item android:state_focused="false" android:state_pressed="true"
android:color="@color/white" />
<item android:color="@color/skyblue" />
</selector>
現在設置此選擇你的TextView的文本顏色屬性 在準備color.xml「值」文件夾
color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#ffffffff</color>
<color name="blue">#39abdf</color>
</resources>