- Xamarin Blueprints
- Michael Williams
- 189字
- 2021-07-08 11:48:19
Creating an Android project
Our first step is to create new general Android app:

The first screen you will land on is MainActivity
. This is our starting activity, which will inflate the first user interface; take notice of the configuration attributes:
[Activity (Label = "Gallery.Droid", MainLauncher = true, Icon = "@mipmap/icon")]
The MainLauncher
flag indicates the starting activity; one activity must have this flag set to true
so the application knows what activity to load first. The icon
property is used to set the application icon, and the Label
property is used to set the text of the application, which appears in the top left of the navigation bar:
namespace Gallery.Droid { using Android.App; using Android.Widget; using Android.OS; [Activity (Label = "Gallery.Droid", MainLauncher = true, Icon = "@mipmap/icon")] public class MainActivity : Activity { int count = 1; protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); } } }
The formula for our activities is the same as Java; we must override the OnCreate
method for each activity where we will inflate the first XML interface Main.xml
.
推薦閱讀
- Testing with JUnit
- 我的第一本算法書
- Apex Design Patterns
- H5頁面設計:Mugeda版(微課版)
- SQL Server從入門到精通(第3版)
- Spring Boot+Vue全棧開發實戰
- Kotlin極簡教程
- 網絡數據采集技術:Java網絡爬蟲實戰
- Building Business Websites with Squarespace 7(Second Edition)
- Python第三方庫開發應用實戰
- 實戰Python網絡爬蟲
- Isomorphic JavaScript Web Development
- Computer Vision with Python 3
- Learning Akka
- Mastering VMware Horizon 6