alibaba / vlayout

Project vlayout is a powerfull LayoutManager extension for RecyclerView, it provides a group of layouts for RecyclerView. Make it able to handle a complicate situation when grid, list and other layouts in the same recyclerview.
http://tangram.pingguohe.net/
MIT License
10.8k stars 1.79k forks source link

使用StaggeredGridLayoutHelper 进行瀑布流时,发现切换数据会导致新数据的item位置错乱问题 #526

Open wuliKingQin opened 3 years ago

wuliKingQin commented 3 years ago

经过研究发现,每次切换数据的时候,发现mLazySpanLookup里面保存的span位置信息还是之前的,所以造成重新填充新的数据的时候,位置还是复用之前的。 解决方案是调用mLazySpanLookup对象里面的clear()方法,清除之前的数据。 目前我是通过反射调用LazySpanLookup对象的clear()方法 未来希望能将LazySpanLookup的clear()方法放出来,是StaggeredGridLayoutHelper对象也调用到,适应更多的场景。