Get a shadow below transparent oval Shape in android xml

Viewed 709

I want a shadow beneath an oval shape (see image below), but I can't figure out how to do it because the shape is a transparent color. For this reason I can't use a layerlist, than you see the shape through the button and not the background. I also tried a half transparent shadow, this works but doesn't look good, I would rather have the shadow black.

This is how I would want it

enter image description here

Thank you in advance

1 Answers

Set below file into your view background for shadow

<?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/grey"/>
        <!--shadow Color-->
    </shape>
</item>

<item
    android:left="0dp"
    android:right="0dp"
    android:top="0dp"
    android:bottom="3dp">
    <shape android:shape="oval">
        <solid android:color="@color/white"/>
    </shape>
</item>

Related