问题
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)?
回答1:
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"
回答2:
Try this..
RatingBar ratingBar = (RatingBar)findViewById(R.id.RATINGinitialvalueratingID);
ratingBar.setRating(5);
ratingBar.setFocusable(false);
来源:https://stackoverflow.com/questions/19206135/using-rating-bar-in-android