Why Does Wrap_content Fire Bindview More Than Once
I am working on an Android app with a listView and am in the process of optimizing it. It uses a custom cursor adapter in one activity and I noticed that bindview() was firing twi
Solution 1:
If I recall correctly from a video from Google I/O, setting the width (or height) of a ListView
to wrap_content
will cause it to measure the first 3 items and base its dimensions off of those. In order to measure those first 3 items, it must call bindView()
to populate them. Once it has measured, it will populate fully and call bindView()
again on those first 3 and any subsequent.
This is due to the fact that the ListView
only keeps in memory what is on the screen when you may have potentially an infinite number of items in the list. It is not designed to wrap_content
to your largest item because it could be stuck in the drawing phase forever.
Post a Comment for "Why Does Wrap_content Fire Bindview More Than Once"