Xamarin Android-Create splash screen (one)

Source: Internet
Author: User

。。。。。。 (Empty talk, less)

Xamarin developed a few technical materials, through learning, their own learning process and the problems encountered in sharing with you.

Splash screen is a picture that appears when the app is launched, and the General app's Splash screen is a dynamic advertising message.

Learn how to load a fixed splash screen first.

First, add code in Resource/values/styles.xml.

<?xml version= "1.0" encoding= "UTF-8"?><resources>  <style name= "theme.splashactivity" parent= " Android:Theme.Holo.Light.NoActionBar ">    <item name=" Android:windowbackground "> @drawable/ic_splash_ Logo</item>  </style></resources>

The Android:windowbackground is set to the picture to be loaded.

Second, create a splashactivity class file, the code is as follows:

namespace myapplication{    using System.Threading;    Using Android.app;    Using Android.os;    [Activity (Label = "SplashScreen", Mainlauncher=true, Nohistory=true, theme= "@style/theme.splashactivity")]    public class splashactivity:activity    {        protected override void OnCreate (bundle bundle)        {            base. OnCreate (bundle);            Set thread wait            thread.sleep (+);             Start mainactivity            startactivity (typeof (Mainactivity));}}    

Parameter description:

1.MainLauncher: Indicates that the activity is a startup activity and is automatically started from this page when the application starts.

2.theme-the custom style file.

3.nohistory-By default, you can move from one activity to the next and back to the previous one from the next. This reason,

We are here splash screen and do not need to return from one to the previous, so its function is not to record historical operations.

Note: The Mainlauncher property cannot be set in Mainactivity, and if set, it will be two app packages at the time of installation.

Xamarin Android-Create splash screen (one)

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.