Reputation: 915
I'm able to display the splash screen with no problem, but I need to provide the correctly sized splash image depending on the screen resolution. In all the examples I've checked, they say to put splashscreen.png into a drawable folder and reference it it in splash.xml which is in turn referenced in a style.xml which is used as the splash activity theme.
splash.xml inside Resources > drawable
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="@color/launcher_background"/>
</item>
<item>
<bitmap
android:src="@drawable/splashscreen"
android:tileMode="disabled"
android:gravity="center"
/>
</item>
</layer-list>
Inside Resources > values > styles.xml:
<style name="splashscreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
Here is my problem:
There is a drawable folder inside Resources, And there are separate mipmap folders inside Resources which are supposed to home the different sizes for splash screens. The examples I've seen only reference a single image from drawable. So the question is, how do I appropriately reference the correct splashscreen.png depending on the device resolution?
Sources:
https://learn.microsoft.com/en-us/xamarin/android/user-interface/splash-screen
https://www.xamarinhelp.com/creating-splash-screen-xamarin-forms/
Upvotes: 0
Views: 3502
Reputation: 437
Image needs to be referenced only from drawable folder and other folders should have the images with exact same name. Based on the resolution device automatically picks the correct drawable folder and image inside it. For more details Click here
Upvotes: 1