How do I add padding to a bitmap and a color in a layer-list How do I add padding to a bitmap and a color in a layer-list android android

How do I add padding to a bitmap and a color in a layer-list


Move the bottom padding from the shape to the parent item:

<?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 android:bottom="20dp">    <shape android:shape="rectangle" >      <solid android:color="@color/color1" />    </shape>  </item></layer-list>

See http://idunnolol.com/android/drawables.html#layer-list for more info.


<?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="#FFE3F5F2"/>        </shape>    </item>    <item        android:bottom="7dp"        android:left="7dp"        android:right="7dp"        android:top="7dp">        <bitmap            android:src="@drawable/ic_link">        </bitmap>    </item></layer-list>


Wrap the bitmap inside an inset drawable and set your padding there