show Background Color Animation ObjectAnimator - Android android.animation

Android examples for android.animation:ObjectAnimator

Description

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  .  j av a2s.  c o  m
        animator.setEvaluator(new ArgbEvaluator());
        animator.start();
    }
}

Related Tutorials