Android编程之一个android的创建平滑的不确定性水平进度条库
白羽 2018-07-24 来源 :网络 阅读 1831 评论 0

摘要:本文将带你了解Android编程之SmoothProgressBar:一个android的创建平滑的不确定性水平进度条库,希望本文对大家学Android有所帮助

SmoothProgressBar是一个android的创建平滑的不确定性水平进度条库

使用gradle 引入库

Java



   

dependencies {

    // of course, do not write x.x.x but the version number

    compile 'com.github.castorflex.smoothprogressbar:library:x.x.x'

    // or

    compile 'com.github.castorflex.smoothprogressbar:library-circular:x.x.x'

}

   

使用

直接使用

Java


   

<fr.castorflex.android.smoothprogressbar.SmoothProgressBar

    xmlns:android="//schemas.android.com/apk/res/android"

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

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:indeterminate="true"

    app:spb_sections_count="4"

    app:spb_color="#FF0000"

    app:spb_speed="2.0"

    app:spb_stroke_width="4dp"

    app:spb_stroke_separator_length="4dp"

    app:spb_reversed="false"

    app:spb_mirror_mode="false"

    app:spb_progressiveStart_activated="true"

    app:spb_progressiveStart_speed="1.5"

    app:spb_progressiveStop_speed="3.4"

    />

 

<fr.castorflex.android.circularprogressbar.CircularProgressBar

    xmlns:android="//schemas.android.com/apk/res/android"

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

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:indeterminate="true"

    app:cpb_color="#FFee44"

    app:cpb_colors="@array/mycolors"

    app:cpb_rotation_speed="1.0"

    app:cpb_sweep_speed="1.0"

    app:cpb_stroke_width="4dp"

    app:cpb_min_sweep_angle="10"

    app:cpb_max_sweep_angle="300"

    />

   

使用style

Java



<style name="AppTheme">

    <item name="spbStyle">@style/GNowProgressBar</item>

    <item name="cpbStyle">@style/CircularThemeProgressBar</item>

</style>

 

<style name="GNowProgressBar" parent="SmoothProgressBar">

    <item name="spb_stroke_separator_length">0dp</item>

    <item name="spb_sections_count">2</item>

    <item name="spb_speed">1.7</item>

    <item name="spb_progressiveStart_speed">2</item>

    <item name="spb_progressiveStop_speed">3.4</item>

    <item name="spb_interpolator">spb_interpolator_acceleratedecelerate</item>

    <item name="spb_mirror_mode">true</item>

    <item name="spb_reversed">true</item>

    <item name="spb_colors">@array/gplus_colors</item>

    <item name="spb_progressiveStart_activated">true</item>

</style>

 

<style name="CircularThemeProgressBar" parent="android:Widget.Holo.ProgressBar">

        <item name="cpb_color">@color/cpb_default_color</item>

        <item name="cpb_stroke_width">@dimen/cpb_default_stroke_width</item>

        <item name="cpb_min_sweep_angle">@integer/cpb_default_min_sweep_angle</item>

        <item name="cpb_max_sweep_angle">@integer/cpb_default_max_sweep_angle</item>

        <item name="cpb_sweep_speed">@string/cpb_default_sweep_speed</item>

        <item name="cpb_rotation_speed">@string/cpb_default_rotation_speed</item>

</style>

   

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标移动开发之Android频道!

本文由 @白羽 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程