Setting up an Android application in Xamarin Studio is just as easy as it is for iOS and is very similar to the experiences in Visual Studio. Xamarin Studio includes several project templates that are specific for Android to jump-start your development.
Xamarin Studio includes the following project templates:
Launch Xamarin Studio and start a new solution. From the New Solution dialog, create a new Android Application under the Android section.
You will end up with a solution looking something similar to what is shown in the following screenshot:
You'll see that the following files and folders specific to Android have been created for you:
Components
folder: This is the same as for iOS projects; the place where components from the Xamarin Component Store can be added.Assets
folder: This directory will contain files with a build
action of AndroidAsset
. This folder will contain raw files to be bundled with an Android application.Properties/AndroidManifest.xml
file: This file contains standard declarations about your Android applications, such as the application name, ID, and permissions.Resources
folder: Resources are images, layouts, strings, and so on that can be loaded via Android's resource system. Each file will have an ID generated in Resources.designer.cs
that you can use to load the resource.Resources/drawable
folder: Any images used by your application are generally placed here.Resources/layout
folder: This contains any *.axml
(Android XML) files that Android uses to declare UIs. Layouts can be used for an entire activity, fragment, dialog, or child control to be displayed on the screen.Resources/values
folder: This contains XML files to declare key-value pairs for strings (and other types) throughout an application. This is how localization for multiple languages is normally set up on Android.MainActivity.cs
file: This is the MainLauncher
action and the first activity of your Android application. There is no static void Main
function in Android apps; execution begins on the activity that has MainLauncher
set to true
.Now let's perform the following steps to run the application:
When all is done, you have deployed your first Android application, complete with a single button. Your app will look like what is shown in the following screenshot:
3.133.127.37