I have a .png image which is a circular shape and is just a shadow. What I have is an ImageButton
which has an image for it's android:src
property. For it's background I can have an xml file in drawable file. What I want now is to have the shadow image which is a png to go behind another solid shape -> android:shape="oval".
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shadowimg" />
<item>
<shape android:shape="oval">
<solid
android:color="#d63a33"/>
<size
android:width="70dp"
android:height="70dp"/>
</shape>
</item>
</layer-list>
As you see in the code I am adding an item with the shadow image with the android:drawable
property. However this does not let the shadow show. It simply shows the red circle shape. But I want the shadow image behind the solid red circle shape. From my tiny knowledge of layer-list the top item goes in the back and the one on bottom comes first.
UPDATE: After moving the image shadow to bottom I got the effect however the size of the solid red circle shape is too big and changing the size doesn't change the size.
UPDATED Code:
<?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="#d63a33"/>
<size
android:width="5dp"
android:height="5dp"/>
</shape>
</item>
<item android:drawable="@drawable/shadowimg" />
</layer-list>
**** UPDATE 2: ****
I noticed when I remove <item android:drawable="@drawable/shadowimg" />
I can change size of solid circle shape but when I add this it defaults to a bigger size.
This is what happens:
Here's the shadow image if anyone needs: