How I can keep aspect ratio if I am using gravity fill_vertical
or fill_horizontal
? In this code:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/_toogle_green"
android:gravity="bottom|fill_vertical"
/>
bitmap fills vertical, but in horizontal keeps original width and aspect ratio is broken.
I believe this question was asked, but I really can't find it, only for ImageView or ImageButton. But I need do that in drawables.
Try this one:
<item>
<bitmap
android:gravity="center|bottom|clip_vertical"
android:src="@drawable/your_image" />
</item>
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