如何设置 Android 小 RatingBar 的颜色

How to set the colors of Android small RatingBar

我正在尝试使用以下代码为小进度条设置自定义颜色:

<style name="RatingBar" parent="Theme.AppCompat">
        <item name="colorControlNormal">@color/gold_yellow</item>
        <item name="colorControlActivated">@color/light_grey</item>
    </style>




<RatingBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:isIndicator="true"
        android:rating="3.3"
        android:theme="@style/RatingBar"
        android:id="@+id/go_rating"
        style="@android:style/Widget.Holo.Light.RatingBar.Small"/>

问题在于:星星虽小,但它们是蓝色的。但是如果我删除 style="@android:style/Widget.Holo.Light.RatingBar.Small 然后颜色变成金黄色但它变大了。

请问如何为星星设置自定义颜色,同时使其变小?

使用style="?attr/ratingBarStyleSmall"风格:

<RatingBar
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:isIndicator="true"
    android:rating="3.3"
    android:theme="@style/RatingBar"
    android:id="@+id/go_rating"
    style="?attr/ratingBarStyleSmall"/>

另请参阅: