Create show Background Color Animation ObjectAnimator - Android android.animation

Android examples for android.animation:ObjectAnimator

Description

Create show Background Color Animation ObjectAnimator

Demo Code


//package com.java2s;

import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;

import android.view.View;

public class Main {

    public static void showBackgroundColorAnimation(View view,
            int preColor, int currColor, int duration) {
        ObjectAnimator animator = ObjectAnimator.ofInt(view,
                "backgroundColor", new int[] { preColor, currColor });
        animator.setDuration(duration);/*from  w  w w.ja  v  a  2  s. co m*/
        animator.setEvaluator(new ArgbEvaluator());
        animator.start();
    }
}

Related Tutorials