法1
在colors.xml,没错,在colors中创建drawable
<span style="font-size:14px;"> <!-- 当按钮为文字时 设置textview按钮属性 -->
<drawable name="white">#ffffff</drawable>
<drawable name="gray">#AAAAAA</drawable>
在selector中
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="@drawable/gray"/>
<item android:color="@drawable/white"/>
</selector></span>
<span style="font-size:24px;">法2</span>
<span style="font-size:14px;">或直接这样:</span>
<span style="font-size:14px;"><selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="@color/down"></item>
<item android:color="@color/white"></item>
</selector>
然后在layout中直接调用就行了</span>
<span style="font-size:14px;"> <TextView
android:id="@+id/aaa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:textColor="@drawable/select_btn_background"
android:textSize="30sp" /></span>