1 实际开发中,遇到在RecycleView 中嵌套的那样
主意,在 onBindViewHolder() 的方法中设置不可以复用的方法
viewHolder.setIsRecyclable(false);
渐变动画前
ObjectAnimator alpha = ObjectAnimator.ofFloat(vh.itemView, "alpha", 0f, 1f);
ObjectAnimator animatorX = ObjectAnimator.ofFloat(vh.itemView, "scaleX", 0f, 1f);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(vh.itemView, "scaleY", 0f, 1f);
AnimatorSet animSetFadeIn = new AnimatorSet();
animSetFadeIn.playTogether(alpha, animatorX, animatorY);
animSetFadeIn.setDuration(500);
animSetFadeIn.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
vh.itemView.clearAnimation();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
animSetFadeIn.start();
在实际开发中,会在监听四个周期,主意在添加回调监听的addListener面添加 start(), 如果顺序反了
onAnimationEnd 回调会不走