博客:http://blog.csdn.net/muyang_ren
按钮修改颜色后,也就把按钮点击后的响应颜色改变了,如果以下面的形式设置按钮颜色,按钮响应时就没有颜色改变了.
<Button
......
android:background="#669966"
/>
按钮有响应颜色需改的有:
1
<Button
......
android:background="@drawable/star_button_select"
/>
2.在drawable文件下新建star_button_select.xml文件,内容如下
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/clr_normal" android:state_pressed="false"/>
<item android:drawable="@color/clr_pressed" android:state_pressed="true"/>
</selector>
3.修改res/values目录下的color.xml(没有就新建一个)
<resources>
<color name="clr_normal">#ff6eff2d</color>
<color name="clr_pressed">#669966</color>
</resources>
时间: 2024-10-12 12:37:19