0

I need to use the RatingBar in my android app with kotlin. I want to decrease the size of star and add a spacing between starsin the RatingBar. Here's my code, but I didn't get what I want.

<RatingBar
        android:id="@+id/ratingBar"
        style="?android:attr/ratingBarStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scaleX=".5"
        android:scaleY=".5"
        android:transformPivotX="0dp"
        android:transformPivotY="0dp"
        android:isIndicator="true"
        android:layout_marginTop="8dp"
        android:progressDrawable="@drawable/rating_bar"
        app:layout_constraintStart_toEndOf="@+id/itemProdImage"
        app:layout_constraintTop_toBottomOf="@+id/textViewNameProduct"
        android:numStars="5"
        android:rating="1"
        android:stepSize="3" />

The following code is rating_bar.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/icn_star_empty"/>
    <item
        android:id="@android:id/secondaryProgress"
        android:drawable="@drawable/icn_star" />
    <item
        android:id="@android:id/progress"
        android:drawable="@drawable/icn_star" />
</layer-list> 

The following picture present the result of my code : enter image description here

The other picture present the result what I want : enter image description here

Lina
  • 553
  • 10
  • 34

0 Answers0