Android examples for Animation:Animation Creation
Add two ObjectAnimator objects to AnimatorSet
import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.support.v7.widget.RecyclerView; public class Main{ public static void animate(RecyclerView.ViewHolder holder, Boolean goesDown) {//from w w w.j a va2 s .c o m AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator objectTranslateY = ObjectAnimator.ofFloat( holder.itemView, "translationY", goesDown == true ? -100 : 100, 0); ObjectAnimator objectTranslateX = ObjectAnimator.ofFloat( holder.itemView, "translationX", -10, 10, 0); animatorSet.playTogether(objectTranslateX, objectTranslateY); objectTranslateX.setDuration(1000); objectTranslateY.setDuration(1000); animatorSet.start(); } }