- Notifications
You must be signed in to change notification settings - Fork0
linux-liu/LoadView
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
一个带进度圆形进度条效果图如下:
###用法直接调用setPercent方法设置进度即可,如下代码模拟下载
publicvoiddownLoad(Viewview) {newTimeDown(12*1000,1000).start(); }privateclassTimeDownextendsCountDownTimer{privatefloati=0;/** * @param millisInFuture The number of millis in the future from the call * to {@link #start()} until the countdown is done and {@link #onFinish()} * is called. * @param countDownInterval The interval along the way to receive * {@link #onTick(long)} callbacks. */publicTimeDown(longmillisInFuture,longcountDownInterval) {super(millisInFuture,countDownInterval);i=0;loadView.setPercent(0); }@OverridepublicvoidonTick(longmillisUntilFinished) {Log.i("lx","onTick"+millisUntilFinished);loadView.setPercent(i);i=i+0.083333f; }@OverridepublicvoidonFinish() {loadView.setPercent(1f); } }
支持自定义参数如下:
<declare-styleablename="LoadView"><!-- 已经load的颜色值--> <attrname="HasLoadColor"format="color" /><!-- 没有load的颜色值--> <attrname="NormalLoadColor"format="color" /><!-- 小长方形的宽度--> <attrname="RectangleWidth"format="dimension" /><!-- 小长方形的高度--> <attrname="RectangleHeight"format="dimension" /><!-- 小长方形的个数--> <attrname="RectangleNum"format="integer" /><!-- 内半径大小--> <attrname="InnerRadius"format="dimension" /><!-- 文字大小--> <attrname="TextSize"format="dimension" /><!-- 小长方形圆角度--> <attrname="RectangleRadius"format="dimension" /> </declare-styleable>
###其他
带进度的圆形进度条的实现