Xamarin Android and xamarinandroid

Source: Internet
Author: User

Xamarin Android and xamarinandroid

...... (Empty talk)

There are very few technical materials developed by Xamarin. After learning, we will share our learning process and problems with you.

Splash Screen is an image that appears when an application is started. Generally, the App's Splash Screen contains dynamic advertisement information.

First, learn how to load a fixed Splash Screen.

1. 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>

Android: windowBackground is set to the image to be loaded.

2. Create a class file of SplashActivity. 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); // sets the Thread to wait for Thread. sleep (2000); // start MainActivity StartActivity (typeof (MainActivity ));}}}

Parameter description:

1. MainLauncher: indicates that the Activity is a startup Activity. When the application starts, it is automatically started from this page.

2. Theme-custom Style File.

3. NoHistory-by default, you can switch from an Activity to the next Activity, or back from the next Activity to the previous one. This is because,

Here is the Splash Screen, which does not need to be returned to the previous one. Therefore, it does not record historical operations.

Note: you cannot set the MainLauncher attribute in MainActivity. If this attribute is set, two application packages will appear during installation.

 

Related Article

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.