Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 220.127.116.11 release ready!
Owner and Founder. Opencart
This blog covers how we can Improve Recycler View Performance. Recently, I’ve been working on an application that has a vertical list in which every item has again a vertical/grid list. I faced recycle view performance problem. It didn’t scroll smoothly. When I scrolled it, it took time to render the items & I faced issue in smooth scrolling.
When we scroll down/up recycleview, the item which moved out from the visible screen becomes scrapped view. For loading the next coming item on screen, recycleview uses scrapped views collection. The view which loaded from scrapped views collection is called dirty view. This selected view is recycled and shown on screen.
Suppose, we have list of 100 items. 5 items can be shown on screen at a time. Currently, we are showing 11-15 items.
When we scroll down, item 12 to 16 will be shown on screen and item 11 will be moved out from visible screen. This item 11 will become scrapped view. If we again scroll down, then item 12 will also become scrapped view and items 13-17 will be shown on screen. We have collection of scrap views: item 11 & 12.
Now for item 18, one of scrap view item will be selected & recycled to show on the screen. This selected item will be called dirty view.
When we scroll items from top to bottom, tell recycleview to load offscreen items in advance. Through which, we can save view recycling time while scrolling & scrolling will become smooth.
We can create our custom LinearLayoutManager & set setExtraLayoutSpace.
Set the number of offscreen views to retain before adding them to the potentially shared recycled view pool.
Suppose, currently item 41-45 are showing on screen. When we scroll bottom to top, if old item will remain in cache then they will be shown easily on screen without any recycling of views or we can say without calling onBindViewHolder(). So for smooth scrolling, we can increase the cache size.
Through these two solution, we can Improve Recycler View Performance.
To learn more about recyclview, please check following link : Recycle View
Hope, this blog will be helpful to you.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.