Home » Android » android – Preload more Views using a ListView-Adapter

android – Preload more Views using a ListView-Adapter

Posted by: admin May 14, 2020 Leave a comment


If I understand correctly the ListView-Adapter loads 1 more view then currently visible on the screen. Lets say view 1 to 5, plus not visible but preloaded view 6. If the user scrolls down, view 1 is dismissed and view 6 gets displayed. I would like to know how to preload more views, like view 6 in the example, but instead of only one view e.g. three views.
I hope by increasing the preloaded-view-count to give the ListView items more time to compute the view / to have a smoother scroll experience.

Since there are so many topics with related key words, a short list what this question is not about:

  • Loading the ListView data model (getting the data from the Web/DB)
  • Loading more data when reaching the end of the ListView
  • It’s not about the ViewHolder pattern (recycling views)

PS: Kind of hard to google this – all keywords that pop up in my mind are already taken by other topics…

How to&Answers:

The class that is responsible for controlling when to hide/show views is LayoutManager.

I’m not very familiar with the inner workings of that class, but I suppose you could create a custom LayoutManager that overrides some of the relevant parts to achieve what you need.