show Card Background Color Animation via ObjectAnimator - Android android.animation

Android examples for android.animation:ObjectAnimator

Description

show Card Background Color Animation via ObjectAnimator

Demo Code


//package com.java2s;

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

import android.view.View;

public class Main {

    public static void showCardBackgroundColorAnimation(View view,
            int preColor, int currColor, int duration) {
        ObjectAnimator animator = ObjectAnimator.ofInt(view,
                "cardBackgroundColor", new int[] { preColor, currColor });
        animator.setDuration(duration);//from www  .ja  v  a  2s  .c  o m
        animator.setEvaluator(new ArgbEvaluator());
        animator.start();
    }
}

Related Tutorials