0

I want to create a drawer handle with three circles with some space in between like

[ o o o ]

I am trying to achieve this with ShapeDrawables

Here is my XML

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <solid android:color="@color/lavender" />
        </shape>
    </item>
    <item>
        <shape android:shape="oval"
            android:left="30dp">
            <solid android:color="@android:color/transparent" />
        </shape>
    </item>
    <item>
        <shape android:shape="oval" android:gravity="right"
            android:left="60dp">
            <solid android:color="@color/lavender" />
        </shape>
    </item>
</layer-list>

I am trying to use padding to offset the items but instead, I get one large oval shape

According to https://developer.android.com/guide/topics/resources/drawable-resource#LayerList

This should be doable with bitmaps but does not mention shapes

Any ideas?

user1743524
  • 655
  • 1
  • 7
  • 14

1 Answers1

0

Got it working; just needed to fiddle with the values

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:left="5dp"
        android:width="4dp"
        android:height="4dp">
        <shape android:shape="oval" android:gravity="center">
            <solid android:color="@color/lavender"
                />
        </shape>
    </item>
    <item
        android:width="4dp"
        android:height="4dp">
        <shape android:shape="oval" android:gravity="right">
            <solid android:color="@color/lavender" />
        </shape>
    </item>
    <item
        android:left="10dp"
        android:width="4dp"
        android:height="4dp">
        <shape android:shape="oval" android:gravity="right">
            <solid android:color="@color/lavender" />
        </shape>
    </item>
</layer-list>
user1743524
  • 655
  • 1
  • 7
  • 14