简体   繁体   中英

Changing image of rating bar in android

i want to use custom ratingbar icons for each rating like below image. I want user to select rating between 1 to 10 . 在此处输入图片说明

Now im trying with the code below:

        <com.whinc.widget.ratingbar.RatingBar
            android:id="@+id/ratingBars"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            app:rb_max_count="10"
            app:rb_count="1"
            app:rb_empty="@drawable/empty"
            app:rb_fill="@drawable/fill"
            app:rb_space="20dp"
            app:rb_click_rating="true"
            app:rb_touch_rating="true"/>

But i can only change full image not individual .please suggest

Use android:stepSize="0.1" & android:numStars="10" like below:

  <RatingBar
                android:id="@+id/rating"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                style="?android:attr/ratingBarStyleSmall"
                android:numStars="10"
                android:stepSize="0.1"
                android:isIndicator="true" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM