Using rating bar in android

Devrath picture Devrath · Oct 6, 2013 · Viewed 8.4k times · Source

I have a rating Bar

<RatingBar
            android:id="@+id/RATINGinitialvalueratingID"
            style="?android:attr/ratingBarStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/RATINGseekBarID"
            android:isIndicator="false"
            android:numStars="5" />

Say there are three stars in this .... i have two questions

  • How to show full stars all the time ?
  • How to disable editing of stars (static display of allocated rating)?

Answer

Szymon picture Szymon · Oct 6, 2013

Try to add the following attribute to show 5 stars:

android:rating="5"

Also, try to add those to make it not editable:

android:isIndicator="true"
android:focusable="false"
android:clickable="false"