Pratik Butani
Pratik Butani

Reputation: 62419

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.

Upvotes: 6

Views: 1826

Answers (1)

Hardy
Hardy

Reputation: 2606

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);

Upvotes: 1

Related Questions