Custom Buttons in Android: How to get border/edge/frame when I read the background from xml?
Posted
by Anna
on Stack Overflow
See other posts from Stack Overflow
or by Anna
Published on 2010-05-26T11:10:32Z
Indexed on
2010/05/26
11:11 UTC
Read the original article
Hit count: 642
android
Hi, Using Android Shapes in xml I have defined a gradient which I use as the background for a button.
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.
The shape is defined as follows:
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: http://developer.android.com/guide/topics/resources/drawable-resource.html
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.
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.
Thanks! Anna
© Stack Overflow or respective owner