老是忘掉那个资源文件怎么写的,还是备注下好了
再次更新下,上次只是改变文字颜色,再添加一个改变背景
改变文字颜色
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:state_selected="true" android:color="@color/。。。" />
<item android:state_focused="true" android:color="@color/。。。" />
<item android:state_pressed="true" android:color="@color/。。。" />
<item android:color="@color/...."></item><!--默认的颜色 -->
</selector>
改变背景图片(颜色改color)
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/button_focused" />
<item android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/button_defocused" />
<item android:state_focused="true"
android:drawable="@drawable/button_focused" />
<item android:state_focused="false"
android:drawable="@drawable/button_defocused" />
</selector>