Skip to content
A RatingBar library for android, you can customize size ,color and image easily!
Java Kotlin
Branch: master
Clone or download
Latest commit 59835fb Jan 17, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea add configuration of origin color of star Jan 14, 2020
app update cpature Jan 14, 2020
gradle/wrapper create Jan 9, 2020
library add configuration of origin color of star Jan 14, 2020
screenshot update cpature Jan 14, 2020
.gitignore create Jan 9, 2020
README.md Update README.md Jan 17, 2020
build.gradle update tag Jan 9, 2020
gradle.properties create Jan 9, 2020
gradlew create Jan 9, 2020
gradlew.bat create Jan 9, 2020
settings.gradle create Jan 9, 2020

README.md

AndRatingBar

API

A RatingBar library for android, you can customize size ,color and image easily!
安卓RatingBar终极方案,继承自原生RatingBar,具有原生的滑动选择等特性,并且可以自定义大小,颜色,图标等

Customize Size

Size Sample

Customize Color & Image

Style Sample

In RecyclerView

List Sample

Implementation

Via Gradle:

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

dependencies {
	implementation 'com.github.giswangsj:AndRatingBar:v1.0.1'
}

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 ->
   Log.e("ratingBar", "rating:$rating")
}

Configuration

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

  • android:rating="1" set the rating of RatingBar
  • android:numStars="8" set the number of star
  • android:layout_height="36dp" set the size of star
  • android:stepSize="0.5" set the step size of RatingBar
  • android:isIndicator="true" set if as indicator

AndRatingBar has it's own configuration as follows:

  • app:starDrawable="" set the drawable of star
  • app:bgDrawable="" set the background drawable of star
  • app:starColor="" set the color of star
  • app:subStarColor="" set the subColor of star
  • app:bgColor="" set the background color of star
  • app:keepOriginColor="" set if keep the origin color of star drawable
You can’t perform that action at this time.