Android Fill Vector Image Transparent Section With Color Using LayerDrawable

Material Vector Image ic_check_circle is a checked mark in a circle, where the checked mark is transparent. I want to fill the checked mark with white color, while outside the circle remain transparent.

The solution is to use LayerDrawable and put a white oval share behind ic_check_circle.

<?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="@android:color/white"/>
            <stroke android:color="@android:color/transparent"
                android:width="5dp"/>
        </shape>
    </item>

    <item
        android:gravity="center"
        android:drawable="@drawable/ic_check_circle_blue_24dp"
        />
</layer-list>

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.