Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Messed rounded corners

I want to create custom button with rounded bottom right and top right corners.

However, I get bottom left and top right rounded instead, although my implementation seems to be ok.

What am I doing wrong?

I use following shape definition stored in drawable folder:

button_shape.xml

<?xml version="1.0" encoding="utf-8"?>
<shape
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle">

  <solid android:color="#F66622"/>
  <padding 
    android:left="5dip"
    android:top="5dip"
    android:right="5dip"
    android:bottom="5dip"
  />
  <corners
    android:radius="20dip"
    android:bottomLeftRadius="0dip"
    android:topLeftRadius="0dip"
  />
</shape>

and the layout file is this:

main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg"
    >
    <Button 
        android:id="@+id/btnFoo"
        android:text="@string/btn_foo_title"
        android:background="@drawable/button_shape"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dip"
        android:layout_centerInParent="true"
        android:textSize="26sp"
    />
</RelativeLayout>

This is the result:

messed corners

I also tried to define each corner radius separately in the button_shape file

...
<corners
    android:bottomLeftRadius="0dip"
    android:topLeftRadius="0dip"
    android:bottomRightRadius="20dip"
    android:topRightRadius="20dip"
/>
...

... with the same result.

Is it possible that this functionality is somehow messed up in Android SDK?

like image 409
Tomas Avatar asked Aug 03 '26 15:08

Tomas


1 Answers

Silly question, but did you try rounding bottomLeft and see if it rounds the bottom-right corner? I know it's not a true solution, but work-arounds are nice too. If it looks the way you want, it doesn't matter how you achieve it.

like image 197
Jin Avatar answered Aug 08 '26 09:08

Jin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!