0

I'm making a quiz app in Android Studio, and I want to add a RatingBar in the quiz result screen. Let's say I got 2 questions correct out of 3 questions and it will show that my mark is 2 on the result screen but I also wantit to fill 2 stars of the RatingBar. The questions I've seen so far is all the reverse way of what I want to do, you usually click on the star and it shows the rating but I want to do opposite

M.K
  • 1
  • 3

2 Answers2

0

Here is the same question as yours, simply add android:isIndicator="true" in xml and setNumStars() in the code, or you can call setIsIndicator() as well.

Community
  • 1
  • 1
Chen Yuan
  • 1
  • 1
0
<RatingBar
        android:id="@+id/ratingbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:isIndicator="true"
        android:numStars="3"
        android:stepSize="1" />

In activity: ratingBar.setRating(2.0);

sj_8
  • 173
  • 1
  • 16