android金额流动

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    //值动画与ObjectAnimator 的不同之一就是值动画没有作用的属性
    ValueAnimator mOffsetAnimator = new ValueAnimator();
    mOffsetAnimator.setInterpolator(new DecelerateInterpolator());
    //添加监听,得到值进行设置
    mOffsetAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            if (animation.getAnimatedValue() instanceof Integer) {
                Integer value = (Integer) animation.getAnimatedValue();
                tv_Maxmoney.setText(formatS(value));
            }
        }
    });

    mOffsetAnimator.setDuration(3000);
    mOffsetAnimator.setIntValues(1, Integer.parseInt(maxmoney));
    mOffsetAnimator.start();
}

你可能感兴趣的:(UI)