1

Basically I have a linear layout with a custom background drawable in order to round the corner. I only want to round the bottom left and bottom right corner.

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle">
        <corners android:radius="5dp"/>
        <solid android:color="#000000" />
    </shape>
</item>
<item android:left="5dp" android:right="5dp" android:bottom="5dp">
    <shape android:shape="rectangle">
        <corners android:topLeftRadius="0.01dp" android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topRightRadius="0.01dp" />
        <solid android:color="@color/app" />
    </shape>
</item>

However, this xml doesn't work. I still get all corner rounded even though I have set an extremely small values for top left and right corner radius. Can anyone help me?

Picture here

Kelok Chan
  • 706
  • 1
  • 8
  • 24
  • 1
    You are using **2** items in alayerlist. The first one has all the corners set to `5dp` – Phantômaxx Oct 08 '15 at 12:17
  • @Kelok, Can you please try http://stackoverflow.com/questions/16161448/how-to-make-layout-with-rounded-corners/16161658#16161658 one ? – Hiren Patel Oct 08 '15 at 12:22

1 Answers1

2

Try this:

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

    <solid android:color="#FFFFFF" />

    <stroke
        android:width="3dip"
        android:color="#92d050" />

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

    <padding
        android:bottom="0dip"
        android:left="0dip"
        android:right="0dip"
        android:top="0dip" />

</shape>
Jas
  • 3,207
  • 2
  • 15
  • 45