Testing to add a custom splash screen for a Maui app, I read some Microsoft docs that says
At build time, the splash screen image is resized to the correct size for the target platform and device. The resized splash screen is then added to your app package.
However, that is not what I am seeing; instead the image is capped by the screen and not adapted. Repro:
- Install VS Studio 2022 17.1.0 Preview 3.0 and latest MAUI
- Create a new .NET Maui App (Preview) project
- Add an SVG file, I used this one: https://publicdomainvectors.org/download.php?file=liftarn_Black_horse.svg and place it in
Resources/Images
- Rename the file to "horse.svg" inside VS (otherwise you will get an build error)
- In Properties, set the Build Action to MauiSplashScreen; this will create a new entry in the csproj file
- I got double <MauiSplashScreen ...> tags in csproj file, so I manually removed the previous one (note: there is a bug, because the Properties panel for the svg no longer says
MauiSplashScreen
- Run the app on emulator, I used Pixel 2 Android Pie 9
When the splash appears, it is not adapted to the screen size, so it is capped. Looks like this (I added Red background):
but the entire SVG images looks like:
So, I wonder what the quote above means? It seems to me that I have to manually shrink the SVG/image somehow, to fit to screen?
Update
I replace height and width in svg with a viewport instead, but the results are the same:
<svg
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:cc="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:svg="http://www.w3.org/2000/svg"
id="svg1322" sodipodi:version="0.32"
viewBox="0 0 680 640"
....
---