I need to create a drawable with a layer-list such that the background layer is an image and the foreground is a transparent color. I am able to do that. Where I am not succeeding is adding some padding/margin so that at them bottom a piece of the images shows without the colored layer on top of it. Here is my xml. Thanks for helping.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<bitmap android:src="@drawable/img1"
/>
</item>
<item>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/color1" />
<padding android:bottom="20dp" />
</shape>
</item>
</layer-list>
Since this configuration is not working, my guess is to put the padding in the first layer. But I am not sure how to do that with a bitmap
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:bottom="20dp" android:left="40dp" android:right="40dp" android:top="20dp"> <shape android:shape="rectangle"> <solid android:color="@color/colorPrimary" /> </shape> </item> <item> <bitmap android:src="@drawable/splash_screen_logo" /> </item> </layer-list>
– Digitalism