I have this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#000000"/>
<size android:width="70dp" android:height="70dp"/>
</shape>
</item>
<item android:drawable="@drawable/ic_person_white_48dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:layout_width="10dp"
android:layout_height="10dp"
/>
</layer-list>
How can I resize the drawable
image? Currently, it's too big for the shape.
I would suggest using A ScaleDrawable. It essentially changes the size of the child drawable using
android:scaleHeight="50%"
android:scaleWidth="50%"
Both are expressed as a percentage of the drawable's current bound.
Maybe it's and old question, but this is how I resize a drawable in a layer-list
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item>
<shape android:shape="oval">
<solid android:color="#000000"/>
<size android:width="10dp" android:height="10dp"/>
<padding android:bottom="30dp" android:top="30dp"
android:left="30dp" android:right="30dp"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/ic_person_white_48dp"/>
</item>
</layer-list>
</item>
</selector>
No need for android:height or android:width
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With