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

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

主站蜘蛛池模板: 历史| 沙雅县| 辰溪县| 灌南县| 科技| 龙里县| 南陵县| 时尚| 资中县| 杭锦后旗| 峨山| 乐安县| 松江区| 荃湾区| 连平县| 洪泽县| 乐平市| 西宁市| 肇东市| 钟祥市| 乐都县| 林西县| 东海县| 五大连池市| 北京市| 绥棱县| 禹州市| 老河口市| 昌吉市| 肃南| 东乌| 阿图什市| 正定县| 隆化县| 临洮县| 海原县| 策勒县| 楚雄市| 清涧县| 高邮市| 巴彦淖尔市|