Search code examples
androidandroid-drawable

How to achieve this drawable using xml in Android


I want the line attached to the left to be curved

I can get the line but it is not curved and using corner radius is not working for the below

<?xml version = "1.0" encoding = "utf-8"?>
<layer-list xmlns:android = "http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape = "rectangle">
            <solid android:color = "#F7B500"/>
        </shape>
    </item>
    <item android:left = "4dp">
        <shape android:shape = "rectangle">
            <solid android:color = "#FFF8E7"/>
        </shape>
    </item>
</layer-list>

Solution

  • Maybe this works for you:

    <?xml version = "1.0" encoding = "utf-8"?>
    <layer-list xmlns:android = "http://schemas.android.com/apk/res/android">
        <item>
            <shape android:shape = "rectangle">
                <solid android:color = "#FFF8E7"/>
                <corners android:radius="2dp" />
            </shape>
        </item>
        <item android:gravity="left">
            <shape android:shape = "rectangle">
                <solid android:color = "#F7B500"/>
                <corners android:radius="2dp" />
                <size android:width="4dp" />
            </shape>
        </item>
    </layer-list>