Quantcast
Channel: Android Step-by-Step
Viewing all articles
Browse latest Browse all 25

How to Declare a RatingBar

$
0
0
RatingBar was added in API Level 1
A RatingBar is an extension of SeekBar and ProgressBar that shows a rating in stars. The user can touch/drag or use arrow keys to set the rating when using the default size RatingBar.

1. In the MainActivity.java file, add the below line to the imports section.

import android.widget.RatingBar;

2. Add the below line to the onCreate method. This will declare a new RatingBar named myRatingBar.

RatingBar myRatingBar;

3. Compile and run!

Next Recommended Article: findViewbyID - How to Find a RatingBar using ID

Resources:
http://developer.android.com/reference/android/widget/RatingBar.html

Viewing all articles
Browse latest Browse all 25

Latest Images

Trending Articles





Latest Images