How do you create a layer-list with two solids next to each other?

Viewed 850

I'm trying to create a drawable with two shapes next to each other using layer-list, how would I do it?

enter image description here

1 Answers

You can use the following code to have the drawable you want(Change the colors and height as you want)

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:gravity="center">
    <shape android:shape="rectangle">
        <size
            android:width="5dp"
            android:height="5dp" />
        <solid android:color="@color/colorAccent"/>
    </shape>
</item>
<item android:gravity="right">
    <shape android:shape="rectangle">
        <size
            android:width="1dp"
            android:height="5dp" />
        <solid android:color="@color/colorPrimary"/>
    </shape>
</item>
</layer-list>
Related