Skip to content

Latest commit

 

History

History
68 lines (59 loc) · 1.75 KB

README.md

File metadata and controls

68 lines (59 loc) · 1.75 KB

EasyRatingView

API

A rating view which can be added spacing between stars.

Usage

<com.aids61517.easyratingview.EasyRatingView
  android:id="@+id/ratingView"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:gravity="center"
  app:emptyDrawable="@drawable/ic_review_empty_small"
  app:fullDrawable="@drawable/ic_review_full_small"
  app:numStars="5"
  app:rating="2.8"
  app:spacing="10dp"
  app:step="0.5" />

result is

result sample

required attributes

app:emptyDrawable 
app:fullDrawable 

optional attributes

app:numStars, default value is 5
app:step, default value is 0.5 
app:maxRating, default value equals numStars 
app:rating
app:spacing
app:verticalSpacing, works when horizontal spacing is not enought
android:gravity, default value is start|top

also you can new one programmatically

EasyRatingView(context).apply {
  emptyDrawableResourceId = //your empty drawable id like R.drawable.ic_review_empty
  fullDrawableResourceId = //your full drawable id like R.drawable.ic_review_full
  rating = 3f
  maxRating = 4f
  spacing = //value in px
}

Download

Add the JitPack repository to the build.gradle file:

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

Add the Gradle dependency:

implementation 'com.github.aids61517:EasyRatingView:1.1.1'