여기에 주어진 코드를 붙이는 방법 ...
1 단계. 당신은 자신의 등급 별이 필요합니다 res/drawable
...
2 단계 다음과 같이 res/drawable
필요합니다 ratingstars.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_empty" />
<item android:id="@android:id/secondaryProgress"
android:drawable="@drawable/star_empty" />
<item android:id="@android:id/progress"
android:drawable="@drawable/star" />
</layer-list>
3 단계 다음과 같이 res/values
필요합니다 styles.xml
...
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="foodRatingBar" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/ratingstars</item>
<item name="android:minHeight">22dip</item>
<item name="android:maxHeight">22dip</item>
</style>
</resources>
4 단계 레이아웃에서 ...
<RatingBar
android:id="@+id/rtbProductRating"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:numStars="5"
android:rating="3.5"
android:isIndicator="false"
style="@style/foodRatingBar"
/>