custom listview adapter getView method being called multiple times, and in no coherent order

后端 未结 11 2100
情话喂你
情话喂你 2020-11-22 04:50

I have a custom list adapter:

class ResultsListAdapter extends ArrayAdapter {

in the overridden \'getView\' method I do a

11条回答
  •  粉色の甜心
    2020-11-22 05:55

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

提交回复
热议问题