如何在用户触摸按钮时更改按钮中的文本颜色?以下是我的shape.xml代码:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" >
<shape android:shape="rectangle">
<gradient android:startColor="#ffcc33"
android:endColor="#ffcc33"
android:angle="270" />
<corners android:radius="4dp" />
<stroke android:width="2px" android:color="#FFFFFF" />
</shape>
</item>
<item android:state_focused="true" >
<shape android:shape="rectangle">
<gradient android:startColor="#ffcc33"
android:endColor="#ffcc33"
android:angle="270" />
<corners android:radius="4dp" />
<stroke android:width="2px" android:color="#FFFFFF" />
</shape>
</item>
<item >
<shape android:shape="rectangle">
<gradient android:startColor="#333333"
android:endColor="#333333"
android:angle="270" />
<corners android:radius="4dp" />
<stroke android:width="2px" android:color="#FFFFFF" />
</shape>
</item>
</selector>