Sticky-Header-Grid
Sticky-Header-Grid copied to clipboard
Sluggish behavior in the scroll for large dataset
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;
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 I tried as per your suggestion but the improvement is not visible.