I tried to create a custom rating bar. I don't use style
because I only use this once. So, I created a layer-list
in the drawable
folder (its name is custom_rating_bar.xml
):
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@drawable/custom_icon_empty"/>
<item
android:id="@android:id/secondaryProgress"
android:drawable="@drawable/custom_icon_empty"/>
<item
android:id="@android:id/progress"
android:drawable="@drawable/custom_icon"/>
</layer-list>
And I use this code in the rating bar to use those icons:
android:progressDrawable="@drawable/custom_rating_bar"
My image size is standard (48x48 for mdpi, etc) and i use a small style rating bar :
style="?android:attr/ratingBarStyleSmall"
The problem is, i cant use style="?android:attr/ratingBarStyleSmall"
together with android:progressDrawable
(When i did this, the images will not shown). When i delete the style (style="?android:attr/ratingBarStyleSmall"
) my rating bar become too big (the images are shown).
This image show how big is it (i think the margin between image is also too much) :
So, how to make my custom rating bar smaller? (as small as the default small style rating bar).
And this custom rating bar is for show only (cant be changed by user).
Thanks.
android:isIndicator="true"
– Stereoscopy