create shape with two cornered edges in android

android, android-layout, rounded-corners

Solution

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

![<?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>][2]

Problem

I am trying to create a shape with two rounded edges and two sharp edges. But I keep getting the following error: ``` The graphics preview in the layout editor may not be accurate: Different corner sizes are not supported in Path.addRoundRect. ``` Here is the code ``` <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#888888" > </solid> <stroke android:width="2dp" android:color="#C4CDE0" > </stroke> <padding android:bottom="5dp" android:left="5dp" android:right="5dp" android:top="5dp" > </padding> <corners android:bottomLeftRadius="11dp" android:topLeftRadius="11dp" > </corners> </shape> ```

Original source

Related problems