AnimatorSet upSet, downSet;
List<Animator> animators = new ArrayList<>();
//创建动画
ObjectAnimator scaleXAnim = ObjectAnimator.ofFloat(itemView, "scaleX", 0.8f);
ObjectAnimator scaleYAnim = ObjectAnimator.ofFloat(itemView, "scaleY", 0.8f);
ObjectAnimator upAnim = ObjectAnimator.ofFloat(itemView, "translationZ", -10f);
// ObjectAnimator upColor = ObjectAnimator.ofArgb(itemView, "backgroundColor", Color.TRANSPARENT);
upSet = new AnimatorSet();
upSet.playTogether(scaleXAnim, scaleYAnim, upAnim);
upSet.setDuration(100);
upSet.setInterpolator(new DecelerateInterpolator());
ObjectAnimator downAnim = ObjectAnimator.ofFloat(itemView, "translationZ", 0);
ObjectAnimator scaleXDownAnim = ObjectAnimator.ofFloat(itemView, "scaleX", 1.0f);
ObjectAnimator scaleYDownAnim = ObjectAnimator.ofFloat(itemView, "scaleY", 1.0f);
// ObjectAnimator downColor = ObjectAnimator.ofArgb(itemView, "backgroundColor", 0);
downSet = new AnimatorSet();
downSet.playTogether(scaleXDownAnim, scaleYDownAnim, downAnim);
downSet.setDuration(100);
downSet.setInterpolator(new DecelerateInterpolator());
animators.add(upSet);
animators.add(downSet);
AnimatorSet as = new AnimatorSet();
as.playSequentially(animators);
as.start();
创建菜单点击动画