Setting up an Android application in Xamarin Studio is just as easy as it is for iOS. It's also 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 that looks something like the following screenshot:
You'll notice that the following files and folders specific to Android have been created for you:
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
: 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
: 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 the following screenshot:
18.117.94.193