Create Splash Screen in Xamarin Forms Android

In this article I am going to explain How to Create Splash Screen in Xamarin Forms Android App.
Before getting started with Splash Screen let’s analyse what is splash screen? and benefits of splash screen.

What is splash screen?
– A a splash screen is initial screen of software with logo or image, usually it appears at the launch of app or software.

What’s the benefits of splash screen?
– Splash screens are usually used to notify the users that the program is initializing. Instead of showing blank screen during the process of data loading of app you can show splash screens to add creativity to your program.

You can add splash screen in your desktop software as well as mobile apps. In this article I am explaining the process to add splash screen to xamarin forms android application.

Create Splash Screen in Xamarin Forms Android

  1. In your Xamarin Android application, create a theme for splash screen in your android resource file ( Resources > Values > styles.xml ).
    There must be some code of previous theme so leave them as it is and paste the following code at the bottom of file.

    <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>
    
  2.  Now open your MainActivity.cs and  change MainLauncher = true. Ensure no other activity has MainLauncher=true.
  3. In MainActivity.cs change the default theme to the splashscreen. After changing the theme your MainActivity.cs look like this
    [Activity(Label = "Mobile App", Theme = "@style/splashscreen", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, LaunchMode = LaunchMode.SingleTop)]
     public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
    ....
    }
  4. In OnCreate method of MainActivity.cs, paste the following code before base.OnCreate() code.
    base.SetTheme(Resource.Style.MainTheme);

  5. Rename your logo/graphics to splash and paste it into drawable folder of xamarin android app.
  6. Now run the android app to check the newly created splash screen in action.
  7. That’s all the steps to Create Splash Screen in Xamarin Forms Android.

Watch the video for live demo, If you have any question or query,  ask it on our Ask Question page.
Check the completed source code on GitHub.