Search code examples
androidxmldrawableandroid-drawablelayer-list

Circle using layer-list drawable not visible properly in Kitkat


I am using the layer-list to draw the circle likeenter image description here

I checked in Android N its working fine but in KitKat, only inner circle with the pink order is showing.

This is my layer-list drawable:

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- larger circle at the back -->
    <item
        android:width="60dp"
        android:height="60dp"
        android:gravity="center">
        <shape android:shape="oval">
            <solid android:color="@color/white" />
        </shape>
    </item>


    <!-- inner circle -->
    <item
        android:width="40dp"
        android:height="40dp"
        android:gravity="center">
        <shape android:shape="oval">
            <solid android:color="@color/white" />
            <stroke
                android:width="1dp"
                android:color="@color/vivid_cerise" />
        </shape>
    </item>
</layer-list>

Solution

  • You have to pay attention to lint warnings:

    enter image description here

    android:width and android:height attributes are accessible from API 23 onwards, whereas KitKat is API 19.