Why i am not able to create the round border for specific corner?

Shreyash Mahajan picture Shreyash Mahajan · Dec 6, 2011 · Viewed 19.4k times · Source

In My android xml layout i am applying the border by using the borderframe.xml as a background.

borderframe.xml file is looks like below:

    <?xml version="1.0" encoding="UTF-8"?>
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke 
        android:width="1dip" 
        android:color="#ffffff"/>
    <solid 
        android:color="#95865F"/>
    <corners 
        android:radius="10px"/>

    <padding 
        android:left="1dp"
        android:right="1dp"
        android:top="1dp"
        android:bottom="1dp"/> 
</shape>

Now, While there is a android:radius="10px" then it is works but while i am going to give round shape to specific corner only then it not works. There is no any erro message in log cat but i found error in eclipse like:

    The graphics preview in the layout editor may not be accurate:
* Different corner sizes are not supported in Path.addRoundRect.

Even if there is no padding in that xml file then also i am not able to see any border.

Now, what should i have to do for it ? and whats the sollution of it if i want to create the rounded border for only topLeftcorner and bottomLeftCorner. ? Thanks.

Answer

Amol Wadekar picture Amol Wadekar · Apr 1, 2014

I am also facing the same problem. But for that I use layer-list. I post my answer here which may help you.
Please check output screen image 1

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
      <shape 
        android:shape="rectangle">
            <stroke android:width="1dp" android:color="#c1c1c1" />
            <solid android:color="#c1c1c1" />
            <corners android:radius="20dp"/>
        </shape>
   </item>

   <item android:right="20dp"
        >
      <shape 
        android:shape="rectangle">
            <stroke android:width="1dp" android:color="#c1c1c1" />
            <solid android:color="#c1c1c1" />
        </shape>
   </item>

</layer-list>