• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Android-CustomRatingBar: 一个自定义的RatingBar

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Android-CustomRatingBar

开源软件地址:

https://gitee.com/kikt/Android-CustomRatingBar

开源软件介绍:

#Android-CustomRatingBar

Custom Rating Bar


English doc

中文文档

project

  • platform :Android
  • language :java
  • version :1.0

install

Add 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'}

screenshot


layout

description


extends 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>

use


xml文件


    <?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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap