慕标600203
2017-09-15 18:26
//释放动画
private ValueAnimator valueAnimator;
/**
* 添加释放操作
*/
public void release(){
if(valueAnimator == null){
final ValueAnimator animator = ValueAnimator.ofFloat(mProgress,0f);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(400);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
Object val = valueAnimator.getAnimatedValue();
if(val instanceof Float){
setProgress((Float) val);
}
}
});
valueAnimator = animator;
}else {
valueAnimator.cancel();
valueAnimator.setFloatValues(mProgress,0f);
}
valueAnimator.start();
}
还没有人回答问题,可以看看其他问题
自定义实现顶部粘性下拉刷新效果
10723 学习 · 29 问题
相似问题