Rating Bar in Android Kotlin?

Sudish Kumar
2 min readNov 27, 2020

After Rating

RatingBar in Kotlin

Android RatingBar is a user interface widget which is used to get the rating from the customers or users. It is an extension of SeekBar and ProgressBar that shows star ratings and it allow users to give the rating by clicking on the stars.

In RatingBar, we can set the step size using android:stepSize and it will always return a rating value as floating point number such as 1.0, 2.0, 2.5 etc. By using, android:numStars attribute we can specify the number of stars in RatingBar. RatingBar is used to get ratings form users or customers about the product, movie or hotel experience etc.

Let’s understood what we will learn in this article .

we will we set progress background background color, progress color and medium size of star ⭐ .

In xml file we can write these codes

<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:scaleX="0.5"
android:scaleY="0.5"
android:stepSize="0.5"
android:visibility="visible"
android:progressTint="#06CD0E"
android:progressBackgroundTint="#a8a8a8" android:layout_marginLeft="10dp"
/>

For progress tint color.

android:progressTint="#06CD0E"

For progress background color.

android:progressBackgroundTint="#a8a8a8"

For reduce star ⭐ size.

android:scaleX="0.5"
android:scaleY="0.5"

That’s all friends,

Thank you friends.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Sudish Kumar
Sudish Kumar

Written by Sudish Kumar

Flutter | Android | Node | Dart | Kotlin | Java | JavaScript | TypeScript | PHP | Short Story Teller | Tech Lead

No responses yet

Write a response