学习笔记之——RatingBar

          记录一下一个好用的RatingBar

          源码地址:传送门

          使用方法:

          1.在build.gradle配置

    compile 'com.hedgehog.ratingbar:app:1.1.2'          

           2.Xml使用写法

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

    android:id="@+id/rb_rider"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    app:clickable="false"
    app:halfstart="false"
    app:starCount="5"
    app:starEmpty="@mipmap/icon_start_hb"
    app:starFill="@mipmap/icon_start_rb"
    app:starHalf="@mipmap/icon_start_half"
    app:starImageHeight="20dp"
    app:starImagePadding="4dp"
    app:starImageWidth="20dp" />

           3.代码中使用写法

 RatingBar rbRider = (RatingBar) findViewById(R.id.rb_rider);
 public String logistics_quality;
 rbRider.setStar(Float.parseFloat(evaluationBean.logistics_quality));

 //点击事件
 rbRider.setOnRatingChangeListener(new RatingBar.OnRatingChangeListener() {
    @Override
    public void onRatingChange(float RatingCount) {
        //执行操作事项
    }
 });


            
  

          


你可能感兴趣的:(Android学习记录)