Giter Club home page Giter Club logo

andratingbar's Introduction

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.giswangsj:AndRatingBar:1.0.5'
}

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
  • app:starSpacing="4dp" set the spacing of the star
  • app:scaleFactor="1.2" the sacle factor of the ratingbar which can change the spacing of the star
  • app:right2Left="true" right to left support

License

AndRatingBar is released under the Apache License version 2.0.

andratingbar's People

Contributors

am-kc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.