Layout Resources:
When we Create Our App Interface, we use some special view that acts as a container. These special views control how other views are placed on the smartphone/tablet screen. Android provides a collection of Layout Managers and each of them implements a different strategy to hold, manage, and place its children.
To create a UI, The best option is XML Vocabulary with tags that define the various types of elements that can compose a view. The concept behind Android XML Layout files is very similar to the way HTML tags are used to define web pages or Microsoft's XAML tags are used to define Windows presentation foundation (WPF) user interfaces.
The following example shows a simple view using a Linear Layout and Containing a Button and an image view.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:text="ChangeImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button1" />
<ImageView
android:src="@drawable/logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView1"
android:scaleType="fitCenter"
android:layout_marginBottom="0.0dp" />
</LinearLayout>
Care must be taken to aligning the name for elements and attributes in the XML vocabulary with class and method names from the application framework. In above Example, the element LinearLayout, Button and ImageView correspond to class names in the Application framework.
IDs:
Each View have a Unique Integer ID associated with it and can be used to reference the view from within an application's code. In XML file, the ID is specified as a User Friendlly text name. For example, consider the following line of code.
android:id="@+id/imageView1"
Using XML Layouts:
XML Layouts can easily be loaded by any application at runtime. This task is generally performed from within the onCreate() method of an activity using the setContentView() method. Consider the follow line of code;
SetContentView(Resource.Layout.Main);
Above line of code will set the content view or user interface of application as define in Resource/layout/main.axmlfile.