小智 15
我猜它为时已晚.但我找到了一种使用ValueAnimator实现这一目标的方法.
ValueAnimator anim = ValueAnimator.ofInt(0, seekBar.getMax());
anim.setDuration(1000);
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int animProgress = (Integer) animation.getAnimatedValue();
seekBar.setProgress(animProgress);
}
});
anim.start();
Run Code Online (Sandbox Code Playgroud)
我已经使用ObjectAnimator.
private void animateProgression(int progress) {
final ObjectAnimator animation = ObjectAnimator.ofInt(mySeekBar, "progress", 0, progress);
animation.setDuration(3000);
animation.setInterpolator(new DecelerateInterpolator());
animation.start();
mySeekBar.clearAnimation();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7915 次 |
| 最近记录: |