Giter Site home page Giter Site logo

ratingbar's Introduction

RatingBar

##android中一个评分的控件 image

如何使用

###Android Studio下:

    dependencies {
        compile 'com.hedgehog.ratingbar:app:1.0.4'
    }

###1,在XML中

<com.hedgehog.ratingbar.RatingBar
    android:layout_marginTop="50dp"
    android:layout_gravity="center"
    android:id="@+id/ratingbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    hedgehog:starCount="5"
    hedgehog:clickable="true"
    hedgehog:starEmpty="@mipmap/ic_star_empty"
    hedgehog:starFill="@mipmap/ic_star_fill"
    hedgehog:starImageSize="30dp"
    />

###注意:别忘了命名空间

xmlns:hedgehog="http://schemas.android.com/apk/res-auto"

###2,在java代码中

   RatingBar mRatingBar = (RatingBar) findViewById(R.id.ratingbar);
    mRatingBar.setOnRatingChangeListener(
            new RatingBar.OnRatingChangeListener() {
                @Override
                public void onRatingChange(int RatingCount) {
                        Toast.makeText(MainActivity.this,"the fill star is"+RatingCount,Toast.LENGTH_LONG).show();
                }
            }
    );
   mRatingBar.setStar(5);
   mRatingBar.setmClickable(true);
   mRatingBar.setStarImageSize(16f);
   mRatingBar.setStarEmptyDrawable(getResources().getDrawable(R.mipmap.ic_star_empty));
   mRatingBar.setStarFillDrawable(getResources().getDrawable(R.mipmap.ic_star_fill));

###关于 因为项目中需要,但是android本身对这个控件的支持并不是很好 所以打算用一个开源的,可是并没有找到称心如意的 然后发现了这个

Android_custom_ratingbarview

RatingBar可以说是照搬上边这个项目的,只是在它的基础上做了一丢丢修改后发布,而且让使用AndroidStudio的同学更加容易引入,不用在这个小东西上浪费时间,同时我也学习了如何发布开源项目到Github ###最后 真心感谢JackWong的开源项目大家想感谢的话也去他那里点赞,毕竟代码都是他的!

ratingbar's People

Contributors

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