Based on this question I was able to determine that the standard button template for e.g. Android 2.2 is located at
C:\Program Files (x86)\Android-sdk\platforms\android-8\data\res\drawable\btn_default.xml
Obviously, the path may be different on your PC. It refers to drawables such as "@drawable/btn_default_normal"
which refer to 9-patch files, e.g. the HDPI ones are
data\res\drawable-hdpi\btn_default_normal.9.png
data\res\drawable-hdpi\btn_default_normal_disable.9.png
data\res\drawable-hdpi\btn_default_pressed.9.png
data\res\drawable-hdpi\btn_default_selected.9.png
data\res\drawable-hdpi\btn_default_normal_disable_focused.9.png
How to find resources: I started from Button.java's constructor (use SDK Manager to download Sources for Android SDK):
this(context, attrs, com.android.internal.R.attr.buttonStyle);
Which refers to an <item>
in res/values/themes.xml
:
<item name="buttonStyle">@android:style/Widget.Button</item>
Which refers to a <style>
in res/values/styles.xml
:
<style name="Widget.Button">
<item name="android:background">@android:drawable/btn_default</item>
<item name="android:focusable">true</item>
<item name="android:clickable">true</item>
<item name="android:textAppearance">?android:attr/textAppearanceSmallInverse</item>
<item name="android:textColor">@android:color/primary_text_light</item>
<item name="android:gravity">center_vertical|center_horizontal</item>
</style>
Which finally refers to res/drawable/btn_default.xml
.