Create A Rating Bar Control In Xamarin Android App Using Visual Studio 2015 Update 3

Introduction

Xamarin is a platform to develop cross-platform and multi-platform apps. (Ex. Windows phone, Android, iOS). In Xamarin, the code sharing concept is used. Xamarin Studio is available in Visual Studio also.

Rating Bar control is used for giving your app the functionality of start rating, as we see in many apps. 

Prerequisites
  • Visual Studio 2015 Update 3 
The following steps are needed to be followed, in order to create a Rating Bar Control in Xamarin Android app.

Step 1 - Click File--> New--> Project. Or, press "Ctrl+Shift+N" in Visual Studio.


Step 2 - Select Installed --> Templates --> Visual C# --> Android --> choose the Blank App (Android). Next, give your Android app a name (Ex:sample) and path for your project. Then, click OK.



Step 3 - Next, go to the Solution Explorer. Select Resource --> Layout --> double click to open Main.axml. Either select Design View or Code View to design your app.






Step 4 - Next, delete the default "Hello World" button by going to the source panel and deleting the button code.



Step 5 -  Now, delete the C# button action code from MainActivity.cs page.




 
Step 8 - Next, go to the toolbox window which has all types of tools and controls. Scroll down. You will see the Rating Bar control.

Drag and drop the Rating Bar control in your Main.axml page wherever you want.

 
The app starts showing the start rating bar, as shown below.



Step 7 - If you have an Android Virtual Device, you can run it there. Otherwise, connect your Android phone via USB connector and enable the USB debugging mode in your device. If you always run the app in this mobile, check the "Always allow from this computer" option.

Step 8 - Now, go to Visual Studio. In the top ribbon, click on the run menu and select your Android device there. 



Output -
After taking some time for building and installing the app, the Android app will run in your Android device.
You can see the output below. 
 


Summery:
So, this was the process of creating Rating Bar Control in Xamarin Android app, using Visual Studio 2015 update 3.

Up Next
    Ebook Download
    View all
    Learn
    View all