Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preload more Views using a ListView-Adapter

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...

like image 464
Klau3 Avatar asked Mar 17 '14 21:03

Klau3


1 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.

like image 95
Juuso Avatar answered Nov 17 '22 19:11

Juuso