12

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

Klau3
  • 317
  • 1
  • 2
  • 9
  • this doesn't answer your question but it explains how recycle works, so it may be useful http://stackoverflow.com/questions/11945563/how-listviews-recycling-mechanism-works – sherpya Mar 17 '14 at 21:55
  • @sherpya Thanks for the link. There are some hints about hight and width calculation that are new to me. – Klau3 Mar 17 '14 at 22:06
  • Have you found a way to change preloaded items count? – sberezin Apr 24 '15 at 11:36
  • 1
    For what it's worth, if you're having problems with smoothness of scrolling, adding more views would not make the scrolling smoother, it would make it worse by creating even more to layout and compute. You'd be better off profiling the code to determine where the slowness is coming from and finding out where to optimize the layout, draws, or adapter bindings. – whizzle Feb 16 '17 at 02:51

1 Answers1

1

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.

Juuso
  • 487
  • 5
  • 12