在使用RatingBar自定义星星的时候,eg:
<style name="RatingBar_CustomColor_Small" parent="Base.Widget.AppCompat.RatingBar">
<item name="android:progressDrawable">@drawable/course_small_start</item>
<item name="android:maxHeight">18dp</item>
<item name="android:minHeight">18dp</item>
</style>
复制代码
其中course_small_start中必须声明background,secondaryProgress,progress,否则RatingBar的stepSize不会生效,eg
<?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/ic_record_course_star_gray" />
<item android:id="@android:id/secondaryProgress"
android:drawable="@drawable/ic_record_course_star_gray" />
<item
android:id="@android:id/progress"
android:drawable="@drawable/ic_record_course_star_normal" />
</layer-list>
复制代码