Android开发之属性动画
程序员文章站
2024-03-25 23:47:40
...
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0f, 1f);
valueAnimator.setDuration(2000);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (float) animation.getAnimatedValue();
System.out.println(value);
}
});
valueAnimator.start();
progressBar = findViewById(R.id.progressBar);
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(progressBar, "progress", 0, 100);
objectAnimator.setDuration(10000);
objectAnimator.start();