<RatingBar android:id="@id/ratingbar" style="@style/sRatingBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:isIndicator="true"//是否用戶交互 android:numStars="10" android:rating="5.0" android:stepSize="1.0" />
sRatingBar.xml
<style name="sRatingBar" parent="@android:style/Widget.RatingBar"> <item name="android:maxHeight">14.0dip</item> <item name="android:progressDrawable">@drawable/comment_rating_bar</item> <item name="android:minHeight">14.0dip</item> </style>
comment_rating_bar.xml
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"android:drawable="@drawable/star_normal" /> <item android:id="@android:id/secondaryProgress" android:drawable="@drawable/star_normal" /> <item android:id="@android:id/progress" android:drawable="@drawable/star_press" /> </layer-list>