欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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();