What are Xamarin and Xamarin Forms?

Prerequisites

The steps given below are required to be followed in order to design FrameLayout View in Xamarin Android, using Microsoft Visual Studio 2017.

Step 1

Step 2

Step 3

Step 4

Afterwards, open Solution Explorer Window. Click Resources folder, followed by clicking Layout folder and opening axml.

Step 4

In this step, click Main.axml page, insert the code given below in Main.axml and save it.

Xamarin

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent">
  5. <ImageView
  6. android:src="@drawable/microsoft"
  7. android:layout_width="fill_parent"
  8. android:layout_height="fill_parent"
  9. android:id="@+id/imageView1"
  10. android:scaleType="centerCrop" />
  11. <TextView
  12. android:text="Microsoft of click at Me"
  13. android:layout_width="fill_parent"
  14. android:layout_height="wrap_content"
  15. android:id="@+id/textView1"
  16. android:textSize="50dp"
  17. android:textColor="#000" />
  18. <TextView
  19. android:gravity="right"
  20. android:text="My Name is Logesh"
  21. android:layout_width="fill_parent"
  22. android:layout_height="wrap_content"
  23. android:id="@+id/textView2"
  24. android:textSize="50dp"
  25. android:textStyle="bold"
  26. android:layout_gravity="bottom"
  27. android:textColor="#fff" />
  28. </FrameLayout>

Click Main.axml Page Designer View, wait for few minutes and Designer View is visible.

Xamarin

The Designer View TableLayout is given below.

Xamarin

Step 5

In this step, click MainActivity.cs page, insert the code given below in MainActivity.cs and save it.

Xamarin

  1. using Android.App;
  2. using Android.Widget;
  3. using Android.OS;
  4. namespace TableLayout
  5. {
  6. [Activity(Label = "TableLayout", MainLauncher = true, Icon = "@drawable/icon")]
  7. public class MainActivity : Activity
  8. {
  9. protected override void OnCreate(Bundle bundle)
  10. {
  11. base.OnCreate(bundle);
  12. // Set our view from the "main" layout resource
  13. SetContentView (Resource.Layout.Main);
  14. }
  15. }
  16. }

Step 6

Step 7

In this step, select Build & Depoly option, followed by clicking to start your Application.

Go to Run option, choose Debug, select any one simulator and run it.

Xamarin

Step 8

Output

Conclusion

Thus, we learned how to create FrameLayout Android Appliacation, using Visual Studio 2017.