上一篇
RecyclerView的onLayout浅析(一)
现在来到dispatchlayoutstep3
其中的这段
if (mState.mRunSimpleAnimations) {
// Step 3: Find out where things are now, and process change animations.
// traverse list in reverse because we may call animateChange in the loop which may
// remove the target view holder.
for (int i = mChildHelper.getChildCount() - 1; i >= 0; i--) {
ViewHolder holder = getChildViewHolderInt(mChildHelper.getChildAt(i));
if (holder.shouldIgnore()) {
continue;
}
long key = getChangedHolderKey(holder);
final ItemHolderInfo animationInfo = mItemAnimator.recordPostLayoutInformation(mState, holder);
..........
mViewInfoStore.addToPostLayout(holder, animationInfo);
}
//循环结束
// Step 4: Process view info lists and trigger animations
mViewInfoStore.process(mViewInfoProcessCallback);
可以看出,就是保存变化之后的view的位置
循环结束之后,process方法就是进行动画的准备
mViewInfoProcessCallback里面有4个方法:
public void