Well, you could use a 9 patch png for your button's background. Your
approach is also fine. I guess, you need a little modificaton with your
shape file.


Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com



On Thu, Nov 25, 2010 at 12:35 AM, gato chlr <[email protected]> wrote:

> Hi, I'm trying to customize a button in order to have a rounded
> button. Also i can't use an image s background. So i need to do draw
> a circle and set it as the background of the button.
>
> I have been trying to draw a shape and use it as button's background
> but, it looks like a rectangle button, with a circle inside. I'm sure
> there is an easy way to do it, thanks for your help
>
> my shape
>
> <shape xmlns:android="http://schemas.android.com/apk/res/android";
>  android:shape="oval">
>  <solid android:color="#0099FF">
>    <stroke android:width="4dp" android:color="#FF000000">
>    </stroke>
>  </solid>
> </shape>
>
> My button
>
> <Button xmlns:android="http://schemas.android.com/apk/res/android";
>  android:id="@+id/btnOval"
>  android:layout_width="wrap_content"
>  android:layout_height="wrap_content"
>  android:text="Click Me2"
>  android:background="@drawable/shape"
>  android:width="150px"
>  android:height="150px"
>  android:textSize="25sp"
>  android:layout_marginLeft="100px"
>  android:layout_marginRight="100px"
>  android:layout_marginBottom="5px"
>  android:layout_marginTop="5px"
>  ></Button>
>
> i have attached the current result in a gif.
>
> thanks for the help
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to