You can look at the source from android's themes.xml
, styles.xml
, and colors.xml
. The one thing you notice from the colors.xml is that there isn't very many colors defined. This is because most of the widgets are done via 9-patch files.
Button style:
223 <style name="Widget.Button">
224 <item name="android:background">@android:drawable/btn_default</item>
225 <item name="android:focusable">true</item>
226 <item name="android:clickable">true</item>
227 <item name="android:textAppearance">?android:attr/textAppearanceSmallInverse</item>
228 <item name="android:textColor">@android:color/primary_text_light</item>
229 <item name="android:gravity">center_vertical|center_horizontal</item>
230 </style>
All of the work done to change the background colors is done in the btn_default
Drawable
.
Source of btn_default.xml:
17 <selector xmlns:android="http://schemas.android.com/apk/res/android">
18 <item android:state_window_focused="false" android:state_enabled="true"
19 android:drawable="@drawable/btn_default_normal" />
20 <item android:state_window_focused="false" android:state_enabled="false"
21 android:drawable="@drawable/btn_default_normal_disable" />
22 <item android:state_pressed="true"
23 android:drawable="@drawable/btn_default_pressed" />
24 <item android:state_focused="true" android:state_enabled="true"
25 android:drawable="@drawable/btn_default_selected" />
26 <item android:state_enabled="true"
27 android:drawable="@drawable/btn_default_normal" />
28 <item android:state_focused="true"
29 android:drawable="@drawable/btn_default_normal_disable_focused" />
30 <item
31 android:drawable="@drawable/btn_default_normal_disable" />
32 </selector>
Each one of those is a 9-patch file. The problem is that those are pngs. The colors are built into the image files and are not defined anywhere. As you've noticed these images can be replaced and the look changes.
Unfortunately, what you want is not possible. You are going to have to choose a single color to go with. This color probably should be chosen to fit with the rest of your application. Sorry :(