Sticky-Header-Grid icon indicating copy to clipboard operation
Sticky-Header-Grid copied to clipboard

Sluggish behavior in the scroll for large dataset

Open vishr opened this issue 5 years ago • 2 comments

Video: https://imgur.com/a/aF5b3nB Tested sample app with the following data:

private static final int SPAN_SIZE = 3;
private static final int SECTIONS = 50;
private static final int SECTION_ITEMS = 200;

vishr avatar Dec 06 '18 19:12 vishr

This is because there are to many visible cells at the screen and RecyclerView recycled view cache is too small. You need to optimize recycled view cache size using RecyclerView.getRecycledViewPool().setMaxRecycledViews

For example try to add following: mRecycler.getRecycledViewPool().setMaxRecycledViews(0, 50); mRecycler.getRecycledViewPool().setMaxRecycledViews(1, 50);

This should fix scroll speed. The only problem that viewType must be internal. So if you have multiple item view types, you need to calculate final viewType.

Codewaves avatar Dec 06 '18 22:12 Codewaves

@Codewaves I tried as per your suggestion but the improvement is not visible.

vishr avatar Dec 07 '18 06:12 vishr