1

I am facing a strange problem with my custom RatingBar drawable. My images of drawables are stretched as you can see in the image.

enter image description here

I don't know what is the issue. I tried different solutions from here but none of them helped me.

Here is my rating bar xml code

<RatingBar
    android:layout_width="wrap_content"
    android:layout_height="30dp"
    android:layout_gravity="center"
    android:layout_marginLeft="20dp"
    android:layout_marginStart="20dp"
    android:maxHeight="30dp"
    android:numStars="5"
    android:progressDrawable="@drawable/ratingbar_custom"
    android:rating="4"
    android:stepSize="1" />

here is drawable 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_filled" />

</layer-list>

And these are 2 images star_empty and star_filled

enter image description hereenter image description here

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Kishan Solanki
  • 13,761
  • 4
  • 85
  • 82

0 Answers0