Here's the layout of a button selector I'm trying to build:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/btt_down" />
<item android:state_enabled="false" android:drawable="@drawable/btt_disabled" />
<item android:drawable="@drawable/btt_normal"/>
</selector>
And here's the layout of the normal state button (btt_normal.xml).
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid android:color="@color/btt_normal"/>
<corners
android:radius="@dimen/rounded_rect_corner_radius"
/>
<padding
android:left="@dimen/rounded_rect_padding"
android:top="@dimen/rounded_rect_padding"
android:right="@dimen/rounded_rect_padding"
android:bottom="@dimen/rounded_rect_padding"
/>
</shape>
The only diff between this layout and the layout of btt_down.xml and btt_disabled.xml is this line:
<solid android:color="@color/..."/>
I would like to know if there's a way to defined a neutral (color free) rounded rectangle drawable resource, and to somehow (inheritance?) assign different colors to it and use them in the selector?
I understand that I can cut down on resources by defining all the rounded rects as part of the selector, but for maintenance sake, I would very much like to avoid copy/pasting the same code lines over and over again with just one color line differentiating between them.
Thank you.