Splash Screen using xamarin form.

 

Splash screen in xamarin form
Splash screen in xamarin form
As you can see in above image that splash screen of famous app is very simple. They just keep background color and add icon in center.

We will create simple splash screen. please watch video to understand the code

Let begin with android project.

Follow the step as given below:

1. First add icon in your android project in Resource -> Drawable folder.

Splash screen in xamarin form
Icon in android project

2. Create xml file with name "splash_background" in Resource -> Drawable folder

3. Copy below code in xml file.

<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <color android:color="#FFFFFF"/>
  </item>
  <item>
    <bitmap
    android:src="@drawable/splashscreen"
    android:tileMode="disabled"
    android:gravity="center"/>
  </item>
</layer-list>  

android:src="@drawable/splashscreen" (splashscreen is the name of the icon) 

<color android:color="#FFFFFF"/> set background color.

4. In Resource -> values -> styles.xml , add below code.

splash screen in xamarin form
Set splash screen style in xamarin
 <style name="MyTheme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_background</item>
  </style> 

In MainActivity Class Update the Theme property to "MyTheme.Splash"

[Activity(Label = "SchoolUIDesigns", Icon = "@mipmap/icon", Theme = "@style/MyTheme.Splash", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]  

Please refer below URL for splash screen for IOS project. As I dont have Mac pc I not able to create demo for it.

https://dev.to/raulmonteroc/setup-a-splash-screen-on-xamarin-forms-4ena

Hope this blog is helpful to you. Please share your feedback in comment section. Thank you for reading.


Comments

Popular posts from this blog

Push Notifications in .NET MAUI: A Comprehensive Guide

Explore the UI libraries available for .NET MAUI at no cost.

Push Notification using Firebase in xamarin form (Android and IOS)