Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android StaggeredGridView Issue

I want GridView like pinterest, for that I have implemented StaggeredGridView lib.

In that i got problem of scrolling. when i scrolling up, the top image are move to next row and top view is going to blank.

I have post issue in following link with image.

Stuck with this Issue of StaggeredGridView

Note:

If i fixed height of ImageView, Its works perfectly but not getting that view which i want.

How can i fix this problem.?

Image

Your Help would be appreciated.

like image 661
Pratik Butani Avatar asked Mar 05 '14 05:03

Pratik Butani


1 Answers

Its been long to answer this but now Recyclerview Supports different layoutmanager so for using staggered with recyclerview just use below code:-

 rcyclerview.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));

And if you want to add this as your header then on bindviewholder in your header part set below code :-

 StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams();
        layoutParams.setFullSpan(true);
like image 86
Hardy Avatar answered Sep 28 '22 07:09

Hardy