Android 2单独查看动画

时间:2016-06-27 14:43:24

标签: android animation android-animation

我有两个单独的动画用于相同的进度条:

@Override
public void onProgressStarted() { 

    mHandler.post(new Runnable() {
        @Override
        public void run() {
            mProgressBar.setVisibility(View.VISIBLE);
            mProgressBar.setProgress(0);
            mProgressBar.setMax(1000);

            ObjectAnimator animation = ObjectAnimator.ofFloat (mProgressBar, "alpha", 1.0f, 0.5f); // see this max value coming back here, we animale towards that value
            animation.setRepeatMode(ValueAnimator.INFINITE);
            animation.setDuration (150); //in milliseconds
            animation.start();

        }
    });

}

@Override
public void onProgressUpdate(final int progress) {
    mHandler.post(new Runnable() {
        @Override
        public void run() {
            int current = mProgressBar.getProgress();

            ObjectAnimator animation = ObjectAnimator.ofInt (mProgressBar, "progress", current, progress*10); // see this max value coming back here, we animale towards that value
            animation.setDuration (1000); //in milliseconds
            animation.setInterpolator (new DecelerateInterpolator());
            animation.start();

        }
    });
}

如何设置ProgressBar进度动画,同时我必须设置进度线宽度(无限/脉冲)或alpha的特定情况?

0 个答案:

没有答案