在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Android-CustomRatingBar开源软件地址:https://gitee.com/kikt/Android-CustomRatingBar开源软件介绍:#Android-CustomRatingBar Custom Rating Barproject
installAdd it in your root build.gradle at the end of repositories: https://jitpack.io/#CaiJingLong/Android-CustomRatingBar Step 2. Add the dependency dependencies { compile 'com.github.CaiJingLong:Android-CustomRatingBar:-SNAPSHOT'} screenshotdescriptionextends viewgroup xml attribute <declare-styleable name="RB"> <!--star width--> <attr name="starWidth" format="dimension"/> <!--star height--> <attr name="starHeight" format="dimension"/> <!--star number--> <attr name="maxStar" format="integer"/> <!--min selected star--> <attr name="minStar" format="float"/> <!--current star count --> <attr name="currentStar" format="float"/> <!--star padding--> <attr name="padding" format="dimension"/> <!--empty star src--> <attr name="emptyStar" format="reference"/> <!--full star src--> <attr name="fullStar" format="reference"/> <!--half star src--> <attr name="halfStar" format="reference"/> <!--is can be change--> <attr name="canChange" format="boolean"/> </declare-styleable> usexml文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingTop="10dp" tools:context="com.dn.ratingbar.MainActivity"> <com.kikt.view.CustomRatingBar android:id="@+id/rb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="10dp" app:currentStar="3.5" app:fullStar="@mipmap/ic_launcher" app:maxStar="5" app:minStar="0.5" app:padding="3dp" app:starHeight="30dp" app:starWidth="30dp"/> <com.kikt.view.CustomRatingBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="10dp" app:currentStar="3.5" app:maxStar="5" app:minStar="0.5" app:padding="3dp" app:starHeight="30dp" app:starWidth="30dp"/> <com.kikt.view.CustomRatingBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="10dp" app:currentStar="4" app:maxStar="6" app:minStar="1.5" app:padding="3dp" app:starHeight="50dp" app:starWidth="50dp"/> </LinearLayout> use java code void onCreate(){ mRb = findViewById(R.id.rb); mRb.setOnStarChangeListener(this); @Override public void onStarChange(CustomRatingBar ratingBar, float star) { Log.d("MainActivity", "star:" + star); } } about me
|
请发表评论