I'm trying to center a drawable image with some padding on either side to use as a splash screen logo. The problem is it's either stretched across the entire screen or ignores any padding if I use gravity
.
<?xml version="1.0" encoding="utf-8"?>
<item
android:drawable="@color/grey_3"/>
<item android:gravity="top|center_horizontal|center_vertical" android:drawable="@drawable/zc_logo_r"
android:top="100dp"
android:left="200dp"
android:right="200dp"
android:layout_margin="100dp"
>
</item>
I've tried using a bitmap, android:gravity="fill_horizontal"
and various other suggestions on SO with the same result.
How can I scale and center the image in my xml?