A scoring control in Android

Source: Internet
Author: User

A control that is scored in ratingbarandroid

How to use Android Studio under:
    dependencies {        ' com.hedgehog.ratingbar:app:1.0.2'    } 
1, in 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"    />
Note: Don't forget to name the space
    xmlns:hedgehog="http://schemas.android.com/apk/res-auto"
2, in Java code
   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));
About
因为项目中需要,但是android本身对这个控件的支持并不是很好所以打算用一个开源的,可是并没有找到称心如意的然后发现了这个* [Android_custom_ratingbarview](https://github.com/JackWong025/Android_custom_ratingbarview) 在他的基础上做了些许修改后发布而且让使用Android Studio的同学更加容易引入,不用在这个小东西上浪费时间同时我也学习了如何用Android Studio发布开源项目到Jcenter
At last
感谢JackWong的开源项目

项目地址:https://github.com/hedge-hog/RatingBar

A scoring control in Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.