2011年8月12日 星期五

[ListView] getView method being called multiple times

This is not an issue, there is absolutely no guarantee on the order in which getView() will be called nor how many times.

In your particular case you are doing the worst thing possible with a list/grid by giving it a height=wrap_content.

This forces ListView to measure a few children out of the adapter at layout time, to know how big it should be. This is what provides ListView with the convertViews you see passed to getView() even before you scroll.


* Reference
- java - custom listview adapter getView method being called multiple times, and in no coherent order - Stack Overflow
getView from CustomizedAdapter called several times - Android Developers | Google Groups

沒有留言:

張貼留言