Android launch_background fit width of image

Viewed 185

I'm trying to add a launch screen image to my app.

This is my launch_background.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@android:color/black" />

    <!-- You can insert your own image assets here -->
    <item>
        <bitmap
            android:gravity="center"
            android:scaleType="fitCenter"
            android:src="@drawable/myAppIcon" />
    </item>
</layer-list>

Now the image is too big and only fits the height of the device. It would need to fit the width so it doesn't extend out of the screen.

I tried adding this:

android:scaleType="fitCenter"

How can I scale the image so it fits the screen width?

Thanks in advance!

0 Answers
Related