Returns the position of the ViewHolder in terms of the latest layout pass.
This position is mostly used by RecyclerView components to be consistent while
RecyclerView lazily processes adapter updates.
For performance and animation reasons, RecyclerView batches all adapter updates until the
next layout pass. This may cause mismatches between the Adapter position of the item and
the position it had in the latest layout calculations.
LayoutManagers should always call this method while doing calculations based on item
positions. All methods in {@link RecyclerView.LayoutManager}, {@link RecyclerView.State},
{@link RecyclerView.Recycler} that receive a position expect it to be the layout position
of the item.
大致意思就是涉及增删查改的话,onBidViewHoudler 的 pos不太准确,使用这个方法获取最新位置
博客介绍了获取RecyclerView中ViewHolder最新位置的方法。因RecyclerView会批量处理适配器更新,可能导致适配器位置与最新布局计算位置不匹配,LayoutManagers计算时应调用该方法,以保证获取准确的布局位置。
1423

被折叠的 条评论
为什么被折叠?



