sliding RecyclerView With Bounce - Android Animation

Android examples for Animation:Slide Animation

Description

sliding RecyclerView With Bounce

Demo Code


import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.support.v7.widget.RecyclerView;

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

        AnimatorSet animatorSet = new AnimatorSet();

        ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(
                holder.itemView, "translationY", goesDown ? 200 : -200, 0);
        ObjectAnimator animatorTranslateX = ObjectAnimator
                .ofFloat(holder.itemView, "translationX", -30, 30, -20, 20,
                        -5, 5, 0);//from w ww  .jav a2 s .  c o  m

        animatorTranslateX.setDuration(1000);
        animatorTranslateY.setDuration(1000);

        animatorSet.playTogether(animatorTranslateX, animatorTranslateY);
        animatorSet.start();

    }
}

Related Tutorials