Xamarin Forms splash screen on Android and iOS

Adding a splash screen to Android and iOS using a Xamarin Forms project isn't as long winded as you think it might be. iOS already has one and Android just requires another activity.

Adding the splash screen to Android:

Android will require another activity to be placed within your app, so within the droid project, create a new class file and name is SplashActivity.cs and add the following code:

using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Support.V7.App;

namespace MyApp.Droid
    [Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
    public class SplashActivity : AppCompatActivity
        static readonly string TAG = "X:" + typeof (SplashActivity).Name;

        public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
            base.OnCreate(savedInstanceState, persistentState);

        protected override void OnResume()

            Task startupWork = new Task(() =>

            startupWork.ContinueWith(t =>
                StartActivity(new Intent(Application.Context, typeof (MainActivity)));
            }, TaskScheduler.FromCurrentSynchronizationContext());


Then in your MainActivity.cs file change the MainLauncher attribute on the MainActivity class to false.

Now add a new file to /Resources/Drawable called splash_screen.xml and add the following:

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

Change applogo to the name of your application splash screen image which should also be in the drawable folder (do not add the file extension to the filename). You can also change the background colour by changing the android:color="#ffffff" part of the file to represent your preferred colour.

Now under Resources/values, create a file called styles.xml and add the following to it:

    <style name="MyTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">

    <style name="MyTheme" parent="MyTheme.Base">

    <style name="MyTheme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/splash_screen</item>
        <item name="android:windowNoTitle">true</item>

That's it for Android, wasn't so difficult was it? I was also surprised when I did it.

Adding the splash screen to iOS:

iOS already has a splash screen that displays a blue background and either a Xamarin logo or your app logo in the middle. This works but let's be honest, it looks horrible having your tiny app icon with perhaps a white background on a blue application background. Ugh.

The only step for making the Launch Screen look better is to open the the LaunchScreen.storyboard file under the /Resources folder. Double clicking the file should open the designer as long as you're connected to a mac.

From here you can click the logo in the center of the screen to change which image to display.

You can also click the background and type in a new background colour code. That should be it, recompile your app and you're good to go.


Published at

Tags: Xamarin

Luke Alderton


Abhishek Singh Thakur
I' using that code but getting a white screen for some time how can I remove this Please suggest
Make sure that SplashActivity has 'MainLauncher=true' set and that your apps MainActivity does not.
Luis Muñoz
Hi, this is great, but i had a problem, when i run the application this message shows in MainActivity: Android.Views.InflateException: Binary XML file line #1: Error inflating class android.support.v7.widget.Toolbar, I tried a lot of solutions posted in other forums but no success, is there any way you can help me with it? thanks
Hi Luis, I've not seen this error before I would look into making sure that your xaml is correct and that you've not missed anything out, you might also want to check your target Android version and that your Android libraries/emulators are all up to date.
Post a comment
Sit tight...
We're adding your comment.
Thank you.
Your comment has been added.
There's been a problem.
Please try again later.
Share with
Latest Comments
By Raymondpef on MVC forms in Umbraco
20 Nov 2018, 23:58 PM
By svetikNoupt on MVC forms in Umbraco
20 Nov 2018, 19:44 PM
By Lestersep on MVC forms in Umbraco
17 Nov 2018, 13:55 PM
By nseo-sw.men on MVC forms in Umbraco
17 Nov 2018, 00:43 AM
By shale.larosh on MVC forms in Umbraco
16 Nov 2018, 22:34 PM
By EdwardPhova on MVC forms in Umbraco
16 Nov 2018, 12:40 PM
By svetikNoupt on MVC forms in Umbraco
13 Nov 2018, 22:04 PM
By nseo-sw.men on MVC forms in Umbraco
13 Nov 2018, 17:47 PM
App Development
Game Development
Web Development