我不知道为什么会出现这种情况,但是调用notifyItemInserted(0)
(只在第一个位置)不会使视图动画化。在其他位置上一切正常。
在这种情况下动画效果有效:
friendsList.remove(positionFriend);
friendsList.add(1, newFriend);
notifyItemInserted(1);
notifyItemRemoved(positionFriend+1);
在这种情况下动画不起作用:
friendsList.remove(positionFriend);
friendsList.add(0, newFriend);
notifyItemInserted(0);
notifyItemRemoved(positionFriend+1);
期望的行为: 元素被插入并在顶部发生插入动画。
目前的情况:没有显示插入动画,实际上我认为“在视觉上”,第一个元素消失并发生移动动画。
notify_
,并让适配器仅作为数据列表和bindView代码。 - Budius