The evaluate method of the ArgbEvaluator class

View view = findViewById(R.id.v_bg); ArgbEvaluator argbEvaluator = new ArgbEvaluator(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(0 ,1); valueAnimator.setDuration(5000); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void OnAnimationUpdate ValueAnimator (animation) {/ / can be according to the percentage of animation. The getAnimatedFraction () update int the evaluate = (int) argbEvaluator.evaluate(animation.getAnimatedFraction(), Color.parseColor("#FF0000"), Color.parseColor("#00FF00")); view.setBackgroundColor(evaluate); }}); valueAnimator.start();Copy the code

GradienteView | GradienteView | GradienteView | GradienteView |