官术网_书友最值得收藏!

Setting up the SpeechTalk.Droid project

Let's do the same for Android and set up Xamarin.Forms accordingly. Inside our Android project, open the MainActivity.cs class and look at the OnCreate function:

[Activity (Label = "SpeechTalk.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity 
    { 
        protected override void OnCreate (Bundle bundle) 
        { 
            base.OnCreate (bundle); 
 
            global::Xamarin.Forms.Forms.Init (this, bundle); 
 
            LoadApplication (new App ()); 
        } 
    } 

The MainActivity class must inherit Xamarin.Forms.Platform.Android.FormsApplicationActivity; we must call the super class OnCreate method before we initialize Xamarin.Forms and load in our new instantiated app class. That's all, we can now run the Android application and see the exact same results, a blank page. Congratulations, you have just shared your first Xamarin.Forms interface.

主站蜘蛛池模板: 曲周县| 淮北市| 天峻县| 宁波市| 利津县| 阿巴嘎旗| 贡山| 弋阳县| 黄骅市| 勃利县| 七台河市| 罗平县| 夏邑县| 田阳县| 南澳县| 桐庐县| 庄河市| 巴南区| 永定县| 基隆市| 东平县| 宁波市| 巴中市| 通渭县| 梅河口市| 岑巩县| 白水县| 库尔勒市| 依安县| 固阳县| 武山县| 申扎县| 绥德县| 友谊县| 民县| 东阿县| 尼木县| 宁津县| 伽师县| 莒南县| 赣州市|