Xamarin.Forms is very slow to start, you must add a boot interface, the steps are as follows: 1. Name the image of the splash screen as: splash_screen.png, and copy it to the appropriate drawable folder under the Resources folder; 2. In the Under the Drawable folder, create a splashscreen.xml with the content:
<?xml version= "1.0" encoding= "Utf-8"?> <bitmap xmlns:android= "Http://schemas.android.com/apk/res/android" android:src= "@drawable/splash_screen" android:gravity= "Fill" android:layout_gravity= "center"/>
3. Under the Resources folder of the Android project, add the "Values" folder, create the Styles.xml, set itsThe content is created as follows:
<?xml version= "1.0" encoding= "Utf-8"?><resources> <style name= "Theme.splash" parent= " Android:Theme.Holo.Light "> <item name=" Android:windowbackground "> @drawable/splashscreen</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></resources>
4. Create a SplashScreen.cs class under the Android project with the following content:
[Activity (Mainlauncher = true, Nohistory = true, Theme = "@style/theme.splash", configurationchanges = configchanges . screensize | Configchanges.orientation)] public class splashscreen:activity { protected override void OnCreate ( Bundle bundle) { base. OnCreate (bundle); var intent = new Intent (this, typeof (Mainactivity)); StartActivity (intent); Finish (); } }
5. Remove "Mainlauncher = true" from the MainActivity.cs class.