Codewaves / Sticky-Header-Grid

Sticky header grid layout manager for RecycleView
MIT License
116 stars 33 forks source link

Sluggish behavior in the scroll for large dataset #26

Open vishr opened 5 years ago

vishr commented 5 years ago

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;
Codewaves commented 5 years ago

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.

vishr commented 5 years ago

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