SmoothProgressBar 水平进度条
来源:互联网 发布:ff14登录网络传输异常 编辑:程序博客网 时间:2024/05/21 15:03
GithubDemo地址:https://github.com/castorflex/SmoothProgressBar
效果图如下:
gradle上添加下面这段代码
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'}
布局文件写下面这段代码
<fr.castorflex.android.smoothprogressbar.SmoothProgressBar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://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="http://schemas.android.com/apk/res/android" xmlns:app="http://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
<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>
或者实例化 它 然后在把他添加到ProgressBar上面。
mProgressBar.setIndeterminateDrawable(new SmoothProgressDrawable.Builder(context) .color(0xff0000) .interpolator(new DecelerateInterpolator()) .sectionsCount(4) .separatorLength(8) //You should use Resources#getDimensionPixelSize .strokeWidth(8f) //You should use Resources#getDimension .speed(2f) //2 times faster .progressiveStartSpeed(2) .progressiveStopSpeed(3.4f) .reversed(false) .mirrorMode(false) .progressiveStart(true) .progressiveStopEndedListener(mListener) //called when the stop animation is over .build());mProgressBar.setIndeterminateDrawable(new CircularProgressDrawable .Builder(this) .colors(getResources().getIntArray(R.array.gplus_colors)) .sweepSpeed(1f) .strokeWidth(mStrokeWidth) .style(CircularProgressDrawable.Style.ROUNDED) [ ... ] .build();
你也可以改变它的颜色
通过XML布局 (use the
app:spb_colors
属性 , 参考这个integer-array
)在代码上 (使用
SmoothProgressDrawable.Builder#colors(int[])
方法).
0 0
- SmoothProgressBar 水平进度条
- SmoothProgressBar
- 水平进度条
- 水平进度条
- ProgressBar进度条(圆形进度条|水平进度条)
- android水平进度条布局
- 自定义水平进度条
- 水平进度条ProgressBar
- android 自定义水平进度条
- 自定义水平进度条
- Android--水平进度条对话框
- 水平进度条 拖拽 效果
- Android自定义水平进度条
- 自定义水平进度条
- 简单的进度条,水平进度条(二)
- ProgressBar 水平进度条(初步)
- 简单的自定义水平进度条
- 自定义水平进度条Horizontal ProgressBar
- 全局变量异常捕获处理
- (*****)Spring MVC 4.1.3 + MyBatis 零基础搭建Web开发框架(注解模式哦)
- MySQL插入语句insert性能优化
- java-web-j2e学习建议路线
- 23种设计模式(17)--Memento模式
- SmoothProgressBar 水平进度条
- HDU 1166 敌兵布阵(树状数组模板)
- 第一个只出现一次的字符
- break中断了什么
- Extjs4 grid 行添加按钮(button)的方法
- 在查找预编译头时遇到意外的文件结尾。是否忘记了向源中添加“#include "StdAfx.h"”?
- 【C++】内联inline、继承、重载与虚函数的解释
- 如何在Matlab中使用Plotly绘图
- ffmpeg架构和解码流程分析