timusus / RecyclerView-FastScroll

A simple FastScroller for Android's RecyclerView
Other
1.39k stars 183 forks source link

Scroll jumps with GridLayoutManager.SpanSizeLookup #21

Closed JonathanMercandalli closed 6 years ago

JonathanMercandalli commented 8 years ago
Scroll position jumps with header and GridLayoutManager(context, 2).
final GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2);
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
    @Override
    public int getSpanSize(int position) {
         return mFileModelCardAdapter.isHeader(position) ?
            gridLayoutManager.getSpanCount() : 1;
    }
});
mRecyclerView.setLayoutManager(gridLayoutManager);
410133062 commented 8 years ago

I have this problem too

timusus commented 8 years ago

This library isn't capable of dealing with rows which differ in size - it assumes all rows are of equal height, and there are a fixed number of items per row.

If you're able to come up with a solution, make a PR and I'll gladly merge it in.

timusus commented 6 years ago

This is resolved with the MeasurableAdapter interface, see the Readme.

JonathanMercandalli commented 6 years ago

Thanks a lot =)

410133062 commented 6 years ago

Thanks.