Coder Social home page Coder Social logo

coloredratingbar-android's Introduction

coloredratingbar-android

Multi-colored Ratingbar for Android.

Right now this is very basic with few values hardcoded into the widget.

ColoredRatingbar Sample Screenshot

Usage

You can make this library project and use the rating bar.

  1. You can include in your layout xml

     <in.flashbulb.coloredratingbar.ColoredRatingBar
       android:id="@+id/coloredRatingBar1"
       style="@style/coloredRatingBarStyle"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_alignParentLeft="true"
       android:layout_marginLeft="16dp"
       android:layout_marginTop="14dp"
       rb:rating="3.8" />
    
  2. There are 4 different styles included coloredRatingBarStyle, coloredRatingBarStyleIndicator, coloredRatingBarStyleSmall, coloredRatingBarStyleSmallIndicator.

  3. Can add listener for rating change.

     ratingBar = (ColoredRatingBar)findViewById(R.id.coloredRatingBar1);
       ratingBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
     	
    
     @Override
     	public void onRatingChanged(ColoredRatingBar ratingBar, float rating,
     			boolean fromUser) {
     		if(rating<=1.6){
     			ratingText.setText("Poor");
     		}else if(rating<=3.2){
     			ratingText.setText("Average");
     		}else{
     			ratingText.setText("Excellent");
     		}
     	}
     });
    

Limitations

Right now the widget is very much limited.

  1. Number of stars fixed to 5.
  2. Color ranges hardcoded in the widget.
  3. Rating from UI can only be in integers. i.e stepsize is fixed to 1.

Including In Your Project

Download/clone and use it as android project library.

Used icons from iconexpo.com if its violation to use them please tell me will remove them.

coloredratingbar-android's People

Contributors

codebreaker avatar

Watchers

 avatar  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.