All Projects → LiangLuDev → DevProgressView

LiangLuDev / DevProgressView

Licence: other
自定义ProdressView-进度条动画

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to DevProgressView

Progressstatusbar
Another way to show progress. A progress View over the system StatusBar.
Stars: ✭ 283 (+1564.71%)
Mutual labels:  progress, progressview
RemainingCountIndicator
Remaining count indicator like a tweet screen of twitter.
Stars: ✭ 17 (+0%)
Mutual labels:  progress, progressview
Theglowingloader
TheGlowingLoader is the highly configurable library to indicate progress and is natively created for Android Platform. It is an implementation of a design composed by Shashank Sahay.
Stars: ✭ 379 (+2129.41%)
Mutual labels:  progress, progressview
GaugeProgressView
Tired of boring Android progress views? This one is amazing!
Stars: ✭ 17 (+0%)
Mutual labels:  progress, progressview
Circleprogressview
🎡 CircleProgressView是一个圆形渐变的进度动画控件(支持外环显示刻度,内环随之变化,配置参数完全可配),动画效果纵享丝滑。
Stars: ✭ 314 (+1747.06%)
Mutual labels:  progress, progressview
Multiprogressview
📊 An animatable view that depicts multiple progresses over time. Modeled after UIProgressView
Stars: ✭ 614 (+3511.76%)
Mutual labels:  progress, progressview
Tileprogressview
Simple Progress View with Tile Animation
Stars: ✭ 126 (+641.18%)
Mutual labels:  progress, progressview
React Sweet Progress
A way to quickly add a progress bar to react app 🌈
Stars: ✭ 239 (+1305.88%)
Mutual labels:  progress
MaterialCircularProgress
Material like circular progress animation sample for iOS.
Stars: ✭ 27 (+58.82%)
Mutual labels:  progress
React Spinners Css
Amazing collection of React spinners components with pure css
Stars: ✭ 232 (+1264.71%)
Mutual labels:  progress
react-redux-spinner
An automatic spinner for react and redux
Stars: ✭ 81 (+376.47%)
Mutual labels:  progress
progressbar
A very simple progress bar for C++ loops
Stars: ✭ 115 (+576.47%)
Mutual labels:  progress
Srdownloadmanager
Powerful and easy-to-use file download manager based on NSURLSession. Provide download status, progress and completion callback block.
Stars: ✭ 221 (+1200%)
Mutual labels:  progress
Spinners React
Lightweight SVG/CSS spinners for React
Stars: ✭ 254 (+1394.12%)
Mutual labels:  progress
fiddler-core-demos
Sample applications demonstrating usages of Progress® Telerik® FiddlerCore Embedded Engine.
Stars: ✭ 64 (+276.47%)
Mutual labels:  progress
Rpcircularprogress
(Swift) Circular progress UIView subclass with UIProgressView properties
Stars: ✭ 236 (+1288.24%)
Mutual labels:  progress
DataDigger
A dynamic dataviewer for your Progress / OpenEdge databases
Stars: ✭ 43 (+152.94%)
Mutual labels:  progress
Stepindicator
StepIndicator is an iOS library that indicates steps in an animated way.
Stars: ✭ 229 (+1247.06%)
Mutual labels:  progress
AMProgressHUD
A gif progress HUD for iOS.
Stars: ✭ 18 (+5.88%)
Mutual labels:  progress
react-native-modal-loader
Customizable animated modal progress hud for react apps.
Stars: ✭ 36 (+111.76%)
Mutual labels:  progress

自定义ProgressView-进度条动画

前两天公司需求,实现进度条动画,本来想在网上找找有没有类似的拿来用,想偷懒都不行。就简单自定义View进度条动画。实现很简单。

动画预览

  • 使用在公司项目效果预览

xz-progressview

  • 简洁效果预览

progressview

代码实现

动画效果很简单,使用ObjectAnimator属性动画来实现,这个官方提供一些Api使用,具体可以查看官方文档。如果以后需要实现更复杂的动画,可以以此为例进行自定义。这里我会对基础自定义View动画实现简单的说明,具体说明在代码注释。如果你们需要的效果跟我的类似,你可以直接把ProgressView文件拷贝下来使用,需要的属性不够用的话可以直接在里面修改添加。

看代码才是王道

  • 自定义View-ProgressView代码(只展示主要代码)
public class ProgressView extends View {

    private void initView() {
        //初始化画笔
        paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        animator = new ObjectAnimator();
        //设置动画属性
        animator.setPropertyName("progress");
        //设置执行动画的View
        animator.setTarget(this);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        //画笔属性
        paint.setAntiAlias(true);                  //设置画笔为无锯齿
        paint.setColor(color);                    //设置画笔颜色
        paint.setStyle(Paint.Style.FILL);
        paint.setStrokeWidth(1);
        //圆角形状设置到画布
        RectF rectF = new RectF(0, 0, progress, getHeight());
        canvas.drawRoundRect(rectF, radius, radius, paint);
    }

    public void startAnim() {
        if (animator.isRunning()) animator.end();
        //设置进度数组,  0 - max
        animator.setFloatValues(0, progress);
        //设置动画时间
        animator.setDuration(duration);
        //动画开启
        animator.start();
    }

}
  • xml添加代码
 <cn.luliangdev.devprogressview.ProgressView
        android:id="@+id/progressview"
        android:layout_width="wrap_content"
        android:layout_height="30dp"/>
  • 代码使用代码
//设置颜色
progressview.setColor(getResources().getColor(R.color.colorAccent));
//设置圆角   默认无圆角
progressview.setRadius(6);
//设置进度条长度    默认px
progressview.setProgress(500);
//设置动画时间
progressview.setDuration(500);
//开启动画
progressview.startAnim();

//动画监听
progressview.getAnimator().addListener(new Animator.AnimatorListener() {
    @Override
    public void onAnimationStart(Animator animation) {
        //动画开始
    }

    @Override
    public void onAnimationEnd(Animator animation) {
       //动画结束
    }

    @Override
    public void onAnimationCancel(Animator animation) {
        //动画取消
    }

    @Override
    public void onAnimationRepeat(Animator animation) {
        //动画重复
    }
});

意见反馈

如果遇到问题或者好的建议,请反馈到:issue、[email protected] 或者[email protected]

如果觉得对你有用的话,点一下右上的星星赞一下吧!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].