In my XML file, I\'m using bitmap as the following
Here t
this one I use for resize my mipmap on to my launch screen.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item android:drawable="@color/colorPrimary"/>
<item
android:width="200dp"
android:height="200dp"
android:gravity="center">
<bitmap
android:gravity="fill"
android:src="@mipmap/ic_launcher"
android:mipMap="true"/>
</item>
</layer-list>
Try to do it this way, this worked for me:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:width="30dp"
android:height="30dp"
android:gravity="center"
>
<bitmap
android:src="@drawable/screen"/>
</item>
</layer-list>
Complete Solution just copy paste and change the Image Path
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:gravity="center"
android:width="286dp"
android:height="176dp">
<bitmap
android:src="@drawable/logo"
android:gravity="fill_horizontal|fill_vertical" />
</item>
</layer-list>
Just use
<item
android:width="200dp"
android:height="200dp"
android:drawable="@drawable/splash_background"
android:gravity="center" />
instead
<item
android:left="200dp"
android:right="200dp">
<bitmap
android:src="@drawable/splash_background"
android:gravity="center" />
</item>
Although there is no width and height parameters for bitmap, you can set bitmap size using gravity and item width/height.
<item
android:width="230dp"
android:height="70dp">
<bitmap
android:gravity="fill_horizontal|fill_vertical"
android:src="@drawable/screen" />
</item>
You can set item width and height and scale bitmap inside of it using gravity.
I know this is old question but maybe someone will find it useful.
WARNING:
As already mentioned in comments, this method ONLY works with API level 23 (Android 6.0) and up.
I just resized the image manually then it works for me