記述方法
セレクターを使って色を分ける
sample.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 通常時 -->
<item android:state_pressed="false" android:state_focused="false">
<shape android:shape="rectangle">
<!-- ボタンの色 -->
<solid android:color="#ff0000" />
</shape>
</item>
<!-- フォーカス時 -->
<item android:state_pressed="true" android:state_focused="false">
<shape android:shape="rectangle">
<!-- ボタンの色 -->
<solid android:color="#00ff00" />
</shape>
</item>
<!-- 押下時 -->
<item android:state_pressed="true" android:state_focused="false">
<shape android:shape="rectangle">
<!-- ボタンの色 -->
<solid android:color="#0000ff" />
</shape>
</item>
</selector>