wdsqjq / AndRatingBar

A RatingBar library for android, you can customize size ,color ,spacing and image easily!Support right to left。效果可以参看:https://juejin.im/post/6844904143220391949
Apache License 2.0
59 stars 17 forks source link

AndRatingBar

API

A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.\ 安卓RatingBar终极方案,继承自原生RatingBar,具有原生的滑动选择等特性,并且可以自定义大小,间距,颜色,图标,支持从右到左

Customize Size

Size Sample

Customize Spacing

Spacing Sample

Customize Color & Image

Style Sample

Right to Left Support

right to left

In RecyclerView

List Sample

Implementation

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    implementation 'com.github.wdsqjq:AndRatingBar:1.0.6'
}

Usage

In your layout file:

<per.wsj.library.AndRatingBar
        android:layout_width="wrap_content"
        android:layout_height="48dp"
        app:starDrawable="@drawable/star_blue"
        app:bgDrawable="@drawable/star_gray"
        android:rating="2.5"/>

Event Listener:

ratingBar.setOnRatingChangeListener { ratingBar, rating, fromUser ->
   Log.e("ratingBar", "rating:$rating -- fromUser: $fromUser")
}

Configuration

AndRatingBar Inherit from Android RatingBar,so all the configuration of RatingBar can be \ configured to AndRatingBar,for example:

AndRatingBar has it's own configuration as follows:

License

AndRatingBar is released under the Apache License version 2.0.