Custom Buttons in Android: How to get border/edge/frame when I read the background from xml?
<p>Using Android Shapes in xml I have defined a gradient which I use as the background for a button.</p>

<p>This all works nice, but there's no edge surrounding the button. I would like it to look similar to the normal Android button but I need more flexibility to control the color and look.</p>

<p>The shape is defined as follows:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"&gt;
    &lt;gradient android:startColor="#FFFFFF" 
        android:endColor="#00FF00"
        android:angle="270" /&gt;
    &lt;corners android:radius="3dp" /&gt;
    &lt;stroke android:width="5px" color="#000000" /&gt;
&lt;/shape&gt;
</code></pre>

<p>I would expect the border to be set in the xml. Why doesn't "stroke" fix it? Stroke doesn't seem to do anything.
I checked the Android Developer spec, but couldn't find the answer there:
<a href="http://developer.android.com/guide/topics/resources/drawable-resource.html" rel="nofollow">http://developer.android.com/guide/topics/resources/drawable-resource.html</a></p>

<p>I have also looked through all the properties of the Android Button, but as expected there's no such parameter, probably since it's built into the normal Android button. Btw, I checked ImageButton properties too.</p>

<p>Can someone please help?
I know there's the alternative to make an image with proper edges and use an ImageButton, but there really should be a way to fix this programmatically.</p>

<p>Thanks!
Anna</p>
