Learn xamarin.forms from scratch (iii) Android production splash screen

Source: Internet
Author: User

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.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.