Android RatingBar

Android RatingBar

A Rating Bar is used to show rating in Stars.The user can touch/drag or use arrow keys to set the rating when using the default size RatingBar.

Example

In this example I will show you how to implement RatingBar in Android.

VIDEO DEMO

Let’s get start by creating a project in Eclipse IDE.

1. Create a new project in Eclipse by navigating to File ⇒ New Android ⇒ Application Project and fill required details. (I kept my main activity name as MainActivity.java).

2.  Create a layout file for MainActivtiy.java under res ⇒ layout folder. I named the layout file as activity_main.xml. In this layout i had taken three RatingBar and some textViews.

3. Now, come to MainActivity.java and add the following code. In this class for the first RatingBar i am showing the number of stars selected in textView and the next RatingBar is used to set the rating to third ratingbar when selected and a toast also displayed.

4. Now, run the app and you will get the output as shown in video.

Thanks. :)

Download Source Code – >

 

 

Leave a Comment

Comment (required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Name (required)
Email (required)