animate Heal on RecyclerView - Android User Interface

Android examples for User Interface:RecyclerView

Description

animate Heal on RecyclerView

Demo Code


import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.OvershootInterpolator;

public class Main{
    public static void animateHeal(RecyclerView.ViewHolder holder,
            boolean goesDown) {

        ObjectAnimator animatorScaleX;//from  w  ww.j  a  v  a  2  s .c  o m
        int x = goesDown ? 100 : -100;
        if (goesDown)
            animatorScaleX = ObjectAnimator.ofFloat(holder.itemView,
                    "translationY", x, 0);
        else
            animatorScaleX = ObjectAnimator.ofFloat(holder.itemView,
                    "translationY", x, 0);

        animatorScaleX.setDuration(1000);
        animatorScaleX.start();
    }
}

Related Tutorials