Android自定义水平进度条控件

ZzHorizontalProgressBar

A Horizontal ProgressBar that is customized easily.

Github传送门:https://github.com/zhouzhuo810/ZzHorizontalProgressBar

功能简介
1.支持自定义进度颜色;
2.支持自定义背景颜色;
3.支持自定义背景与进度之间的内间距大小;
4.支持自定义最大值和默认进度值。

与系统控件相比的优势:属性配置更简单、大小适配更方便。

Gradle:

compile 'me.zhouzhuo.zzhorizontalprogressbar:zz-horizontal-progressbar:1.0.3'

Maven:

<dependency>
  <groupId>me.zhouzhuo.zzhorizontalprogressbar</groupId>
  <artifactId>zz-horizontal-progressbar</artifactId>
  <version>1.0.3</version>
  <type>pom</type>
</dependency>

<h3>What does it look like?</h3>

《Android自定义水平进度条控件》 zzhorizontalprogressbar.gif

<h3>How to use it ?</h3>

1.xml

    <me.zhouzhuo.zzhorizontalprogressbar.ZzHorizontalProgressBar
        android:id="@+id/pb"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        app:zpb_padding="0dp"
        app:zpb_pb_color="@android:color/holo_green_dark"
        app:zpb_bg_color="@android:color/holo_blue_bright"
        app:zpb_max="100"
        app:zpb_progress="30"
        />

2.java

        final ZzHorizontalProgressBar pb = (ZzHorizontalProgressBar) findViewById(R.id.pb);

        //set progress value
        pb.setProgress(progress);

        //set padding
        pb.setPadding(0);       

        //set bacground color
        pb.setBgColor(Color.RED);

        //set progress color
        pb.setProgressColor(Color.BLUE);

        //set max value
        pb.setMax(100);     

</br>
<h3>属性说明:</h3>

属性作用类型
zpb_padding背景与进度之间的内间距大小dimension
zpb_bg_color背景颜色color
zpb_pb_color进度颜色color
zpb_max进度最大值int
zpb_progress默认进度值int

玩安卓版王者荣耀的朋友,刷金币看这里
链接:http://pan.baidu.com/s/1gfKIeh9
辅助群:171977523

需要写安卓程序的小伙伴请关注我的淘宝店铺:
小周来帮您

    原文作者:zhouzhuo810
    原文地址: https://www.jianshu.com/p/e57ca384e89a
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞