Search code examples
androidvisual-studioxamarinxamarin.formsxamarin.android

Use two images in Xamarin Forms Android Splash Screen


I am completely new to Xamarin Forms Cross Platform Development. I wan to implement Whatsapp like Splash Screen. See belowenter image description here

With my existing code I am not able to use two different images in a splash screen. Followed the normal splash screen tutorials and able to generate simple splash with single image. here piece of code from my Splash.XMl (theme file)

<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <color android:color="@color/primary"></color>
  </item>

  <item>
    <bitmap android:src="@drawable/Logo" android:gravity="center" android:tileMode="disabled"></bitmap>
    <bitmap android:src="@drawable/ack" android:gravity="bottom" android:tileMode="disabled"></bitmap>

  </item>


</layer-list>

I used two different <item></item>but no success. Please help. Thanks in Advance.


Solution

  • Would you try with this

    <?xml version="1.0" encoding="UTF-8" ?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
        <item>
               <color android:color="@android:color/white" />
        </item>
        <item>
            <bitmap
              android:src="@drawable/xamarin_small"
              android:gravity="center"/>
        </item>
        <item android:bottom="40dp">
            <bitmap
              android:src="@drawable/microsoft"
              android:gravity="center_horizontal|bottom"/>
        </item>
    </layer-list>
    

    With the code above I am able to display the two images as part of the background for the launcher.

    enter image description here

    Hope this helps.-