RatingBar是SeekBar和ProgressBar的扩展,用来显示星形的等级。 RatingBar有两个Style: The smaller RatingBar style ( ratingBarStyleSmall) and the larger indicator-only style (ratingBarStyleIndicator)只能用来显示不能操作。
style="?android:ratingBarStyleSmall"
style="?android:ratingBarStyleIndicator"
Android RatingBar的常用的XML参数和方法:
Attribute Name | Related Method | Description |
---|---|---|
android:isIndicator | setIsIndicator(boolean) | Whether this rating bar is an indicator (and non-changeable by the user). |
android:numStars | setNumStars() | The number of stars (or rating items) to show. |
android:rating | setRating() | The rating to set by default. |
android:stepSize | setStepSize() | The step size of the rating. |