Reputation: 365
I have a listView
, with some very heavy items (Non scrollable GridView
, and some TextView
). I have implemented the ViewHolder
pattern in the adapter but still the scrolling is not smooth. Can we specify in the ListView
, as to how many items it should keep in memory. I have only 3 items in the listView
but on scrolling , it always have some discontinuity when a new item come into view.
Example: Initially 1st child and some portion of 2nd clild is visible, then user scroll, when he is about to hit the 3rd item, there is a slight discontinuity and then 3rd item appear. On scrolling up, the same thing happens when 1st child is about to enter the screen again.
Can we somehow specify that the listView
should keep 3 items in memory and dont recycle them, like we do in case of ViewPager(using setOffscreenPageLimit). I know there is no built in support to specify that, but can we extend listView somehow to have such functionality.
Upvotes: 1
Views: 242
Reputation: 10859
To answer your question is
NO
Do this, set or View
s VISIBILTY
to GONE
and use the postion
in getView()
parameter to to know if its the first item or not. Then set the required View
s for that particular position to VISIBLE
and all other View
s to GONE
Does it seem helpful to you?
Upvotes: 1