0
我已經爲我的recyclerview
應用於動畫如下如何在notifyItemRemoved()後暫停/停止recyclerview動畫?
SlideInRightAnimator animator = new SlideInRightAnimator();//using custom Animation to remove the recyclerview Item
animator.setRemoveDuration(200);//specify the duration to run the animation
mRecyclerView.setItemAnimator(animator);
我申請這個動畫上recyclerview,因爲我不知道 不過,我想取消停止動畫在我的適配器一次一次我做notifyItemRemoved()
。
我明白onBindViewHolder
被立即調用,但不知道如何將我的動畫師傳入我的Recyclerview
適配器或一般調用停止動畫。
我在片段eventbus處理器和我呼籲適配器RemoveItem方法如下。
public void onEventMainThread(MyEvent event) {
switch (event.getEventType()) {
......
case DELETE:
mAdapter.removeItem(event.getItem());
break;
default: break;
}
}
更新:我也試着做以下後,我打電話通知項目中刪除:
mRecyclerView.setItemAnimator(null);
但這最終取消動畫一起
感謝您的一種迴應
新的'notify'方法將總是調用動畫。 –
動畫師有一個'endAnimations()'函數,你可以給它一個鏡頭。 –
@NikolaDespotoski你能再細說一點嗎?我只有我的Fragment中的動畫師參考,而不是適配器中的參考。 – Akshay