ExactRatingBar

General

Category
Free
Tag
Feedback & Ratings
License
N/A
Min SDK
19 (Android 4.4 KitKat)
Registered
Sep 25, 2019
Favorites
1
Link
https://github.com/Jamshid-M/ExactRatingBar
See also
Android Survey
RatingReviews
Maoni
Rating Request
RateDialog

Additional

Language
Kotlin
Version
1.0.0 (Sep 25, 2019)
Created
Sep 25, 2019
Updated
Sep 25, 2019 (Retired)
Owner
Jamshid Mamatkulov (Jamshid-M)
Contributor
Jamshid Mamatkulov (Jamshid-M)
1
Activity
Badge
Generate
Download
Source code

ExactRatingBar

RatingBar with exact values.

Usage

Add it in your root build.gradle at the end of repositories

repositories {

        maven { url 'https://jitpack.io' }
    }
dependencies {
 implementation 'com.github.Jamshid-M:ExactRatingBar:1.0.0'
}

Open activity and specify ExactRatingBar object and setup listener for it, you can use simple interface callback or lambda

        var rate = findViewById<ExactRatingBar>(R.id.rate)
        rate.onRatingBarChanged = object : ExactRatingBar.OnRatingBarChanged{
            override fun newRate(rate: Float) {
                Toast.makeText(this@MainActivity, rate.toString(), Toast.LENGTH_LONG).show()
                Log.d("MYTAG", "interface$rate")
            }
        }

        rate.onRateChanged = {
            Log.d("MYTAG", "lambda$it")
        }

You can set properties of RatingBar in xml

<uz.jamshid.library.ExactRatingBar
        android:id="@+id/rate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        app:starCount="5"
        app:isIndicator="false"
        app:starFillColor="@color/colorAccent"
        app:starSize="96"
        app:starValue="3.5"
        />

starCount specifies number of stars
isIndicator enables/disables touch listener, by which user enables or disables seeking in RatingBar
starFillColor color of star
starSize size of star
starValue rate of star, e.g 3.5 out of 5