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

  • Xamarin Blueprints
  • Michael Williams
  • 124字
  • 2021-07-08 11:48:22

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.

主站蜘蛛池模板: 凤山县| 工布江达县| 酒泉市| 北辰区| 阿勒泰市| 江口县| 乌兰县| 丰台区| 彰化县| 盐亭县| 兴业县| 临朐县| 宁南县| 宝兴县| 松滋市| 方山县| 岐山县| 鸡东县| 崇信县| 五河县| 商河县| 昌都县| 六安市| 綦江县| 临安市| 青海省| 伊春市| 闽侯县| 康乐县| 永新县| 上林县| 剑川县| 稷山县| 宜昌市| 民县| 抚顺县| 辽中县| 奉节县| 泰宁县| 海淀区| 文成县|