I\'m playing around with the StaggeredGridLayoutManager and have something close to what I want. I have a horizontal staggered grid with 2 rows, where some items are the hei
Maybe I'm wrong (there's no good documentation about this out there yet), but I think you cannot achieve that with this layout manager. The staggered layout manager lets you place your views within spans, and if you place one that occupies the all of the spans, it will calculate the position for the next view based on the current one (without taking a look at the previous one).
In other words, if you place a view that occupies all of the spans, the layout manager will find the shortest span for the next view, and because you occupied all of them with the same view, the first span is the candidate.
I hope this helps you!
Doing this will requires not respecting position of items in the adapter which is hardly ever desired. Your best options is to re-order items in the adapter
What you want to achieve is completely posible with GridLayoiutManager instead of StaggerdLayoutmanager. Here , I would have use Gridlayoutmanager as follows.
mGridLayoutManager = new GridLayoutManager(mContext,2,GridLayoutManager.HORIZONTAL,false);
mGridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if(position==0 && position ==1){
return 1;
}else {
return 2;
}
}
});