//从蓝色到红色的背景变化
private void toggleBackgroundColor(int BLUE, int ORANGE,int RED, long duration) {
ValueAnimator colorAnim = ObjectAnimator.ofInt(findViewById(R.id.root), "backgroundColor", BLUE,ORANGE, RED);
colorAnim.setDuration(duration);
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.setRepeatCount(0);
colorAnim.setRepeatMode(ValueAnimator.RESTART);
colorAnim.start();
mColorAnim = colorAnim.clone();
}
//从0到最大值的变化
private void changeText(int size) {
ValueAnimator valueAnimator = ValueAnimator.ofInt(0, size);
valueAnimator.setDuration(ANIMATION_DURATION_MILLIS);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int progress = (int) animation.getAnimatedValue();
mTvPhoneScore.setText(progress + "MB");
}
});
valueAnimator.start();
}