ドローアブルリソースとして定義されているカラーリソースにアクセスしたいのですが、JAVAで背景色を切り替えたいのですが、基本的にボタンの背景は下記のドローアブルXMLを使用して変更しました。ボタンにアクセスして色属性を変更してみましたが、ボタンの形が通常の正方形に変わりました。ドローアブルXMLで定義された形状を維持し、背景色を手動で変更したい。
<?xml version="1.0" encoding="UTF-8"?>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="#EAEAEA" />
<corners android:bottomLeftRadius="8dip"
android:bottomRightRadius="1dip"
android:topLeftRadius="1dip"
android:topRightRadius="8dip" />
</shape>
</item>
<item><shape android:shape="rectangle">
<solid android:color="#EAEA00" />
<corners android:bottomLeftRadius="8dip"
android:bottomRightRadius="1dip"
android:topLeftRadius="1dip"
android:topRightRadius="8dip" />
</shape>
</item>