maurycyw / StaggeredGridView

A modified version of Android's experimental StaggeredGridView. Includes own OnItemClickListener and OnItemLongClickListener, selector, and fixed position restore.

Home Page:https://github.com/maurycyw/StaggeredGridViewDemo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Items order was changed when reload items.

waynell opened this issue · comments

I use StaggeredGridView to load images in my app,there is a reload function,but when i reload these items,the items order was changed.For example,when I first into the StaggeredGridView,the picture one on the left and picture two on the right,but when I click the reload button,pictures order was changed.
Follow is the reloadItems function,I used LinkedList to holder data.
public void reloadItems(ArrayList<?> items) {
linkedList.clear(); //put data into the LinkedList.
linkedList.addAll(items);
mAdapter.notifydatasetchanged();
}

Oh.I already know the reason of this problem.In getNextColumnDown() function,it also return the min value's index of mItemBottoms.