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

后端 未结 11 2269
情话喂你
情话喂你 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:39

    I am not able to answer your "Why" question but i definitely have a solution to the problem of the irritating "ListView items repeating" problem(if you have items in ur collection which are more than the screen height).

    As many people above have mentioned, keep the android:layout_height property of the ListVew tag as fill_parent.

    And about the getView() function, the solution is to use a static class called ViewHolder. Check out this example. It successfully does the task of adding all the items in ur Array or ArrayCollection.

    Hope this helps friends!!

    Best Regards, Siddhant

提交回复
热议问题