Reputation: 86
I'm tried to make a fullscreen splash (with a background image) in Flutter Android (in iOS everything seem easier).
But in default launch background, the bitmap tag seem not to be cover the height and width, i tried gravity attributes: fill, fill_vertical, fill_horizontal, ... but the result not as expected, when i use "fill_vertical" the width is shrinking a bit although the height is correct, the "center" is not full screen.
In gravity center:
What I'm expected
I think "bitmap" can not cover with keep ratio image.
file launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_color"/>
<item>
<bitmap android:gravity="fill_vertical" android:src="@drawable/splash"/>
</item>
</layer-list>
Please help, thank you.
Upvotes: 0
Views: 2497
Reputation: 10473
The way Android launch screen works is the background drawable is stretched to fit the screen and the logo - usually the second item in the layer-list
is centered. What you can do here as a workaround is separate the background of the image with the foreground character.
Upvotes: 0