Question:
I’m new to Android programming, trying to create a splash screen with image. Currently I have this code :<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item>
<bitmap
android:src="@drawable/splash"
android:gravity="fill"/>
</item>
</layer-list>
This result I get is a centered image with empty space top and bottom.I tried multiple constants like center, fill, fill _horizontal, etc.. Also tried to replace bitmap with ImageView, but I think I need some more knowledge how to propely use it.
I’m trying to make the image fill the screen like this :

Answer:
I used android:dither=”true” for bitmap, code like this :<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item>
<bitmap
android:src="@drawable/splash"
android:dither="true"
/>
</item>
</layer-list>
If you have better answer, please add a comment about this, thank you!
Leave a Review