Android - Make check icon using xml drawable

Anonymous picture Anonymous · Sep 8, 2016 · Viewed 7.1k times · Source

enter image description here

How can I make this shape using xml drawable? Been fighting over it quite some time and can't get it done.

Answer

R. Zagórski picture R. Zagórski · Sep 8, 2016

Here is the template you could improve:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:width="30dp"
        android:height="4dp"
        android:top="20dp">
        <rotate
            android:fromDegrees="45">
            <shape android:shape="rectangle">
                <solid android:color="@android:color/holo_orange_dark"/>
            </shape>
        </rotate>
    </item>

    <item
        android:width="40dp"
        android:height="4dp"
        android:top="15dp"
        android:left="18dp">
        <rotate
            android:fromDegrees="-45">
            <shape android:shape="rectangle">
                <solid android:color="@android:color/holo_orange_dark"/>
            </shape>
        </rotate>
    </item>

    <item
        android:width="50dp"
        android:height="50dp">
        <shape android:shape="rectangle">
            <solid android:color="@android:color/transparent"/>
        </shape>
    </item>
</layer-list>