RecyclerView的onLayout浅析(二)

本文详细分析了RecyclerView在dispatchLayoutStep3阶段如何处理视图位置变化,并涉及DefaultItemAnimator的角色。通过讲解processDisappeared方法,阐述了如何进行动画准备。DefaultItemAnimator的animateRemove、animateMove、animateChange和animateAdd方法分别对应不同类型的动画效果。最后讨论了动画执行顺序及ItemAnimatorListener在动画结束后的处理逻辑。
摘要由CSDN通过智能技术生成

上一篇
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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值