Tuesday January 29th, 2019

Xamarin.Forms Splah Screen

By Ebubekir Sezer

Splash screen is a screen when you open your application. Splash screen stay on the screen until the your application load data. When you use splash screen on your xamarin application you have to write some special code for each platform, I will do for the android.

I will add picture for my splash screen, for that i have to add picture to the drawable folder but it changes with your pic size, you have to add your pic to the right drawable folder. Later we will create style for the splash screen you can customize your style, I created style with the name of MyScreen under the Resources/values/styles.xml.

  <style name="MyScreen" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@drawable/MyScreen</item>

After the set style for the splash screen, we will create a class in the android platform. I put class name SplashActivity. Inside of the class we have to write these codes;

[Activity(Icon ="@drawable/MyScreen", Theme = "@style/MyScreen", MainLauncher = true, NoHistory = true)]
    public class SplashActivity:AppCompatActivity
        protected override void OnResume()

Finally, we have to change MainLauncher=true to the MainLauncher=false in MainActivity. When we run the application, splash screen will be appear. You can ask your questions via comments or e-mail.