- 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
.
推薦閱讀
- Cocos2d Cross-Platform Game Development Cookbook(Second Edition)
- Learning Docker
- Mastering Concurrency in Go
- NLTK基礎教程:用NLTK和Python庫構建機器學習應用
- Python Game Programming By Example
- x86匯編語言:從實模式到保護模式(第2版)
- AngularJS深度剖析與最佳實踐
- Object-Oriented JavaScript(Second Edition)
- C/C++常用算法手冊(第3版)
- Visual C++串口通信技術詳解(第2版)
- TypeScript實戰指南
- Java性能權威指南(第2版)
- 零基礎Java學習筆記
- Python機器學習算法: 原理、實現與案例
- Quantum Computing and Blockchain in Business