我找到了解决方案:
需要调用方法setRemoveDuration(长持续时间)并设置持续时间 等于动画的持续时间(我的情况4000)
我使用DefaultItemAnimator为RecyclerView创建了一个简单的动画。我的动画幻灯片元素被移除到右侧。一切都很好,除了动画开始太快。当幻灯片动画完成时,我如何/在何处锁定它并手动启动(adnimationMoved)。
我的自定义默认动画制作工具
public class CustomMainDefaultAnimator extends DefaultItemAnimator {
Context context;
public CustomMainDefaultAnimator(Context context) {
this.context = context;
setSupportsChangeAnimations(false);
}
@Override
public boolean animateRemove(RecyclerView.ViewHolder holder) {
Animation animation = new CustomAnimation(context).slideOut(4000);
holder.itemView.startAnimation(animation);
return super.animateRemove(holder);
}
@Override
public boolean animateAdd(RecyclerView.ViewHolder holder) {
Animation animation = new CustomAnimation(context).slideIn(4000);
holder.itemView.startAnimation(animation);
return super.animateAdd(holder);
}
}
答案 0 :(得分:0)
您可以使用Animator类的方法isRunning()
并观看第一个动画直到完成,因此方法isRunning()
返回false,然后开始下一个动画。