Why does getView return wrong convertView objects on SeparatedListAdapter?

孤人 提交于 2019-12-02 19:24:38

I traced the problem to be the listviews's RecybleBin object. It stores the possible convertViews based on their reported types from getItemViewType, however its contents are never updated after you change the dataset (thus positions), then when your adapter gets what used to be a type "X" view based on its position, but now it happens to be a type "Y". A solution is to manually check on getView wether not only the convertView is null, but wether it is of the correct type (that's really awkward sometimes... If you use the view holder pattern you could check if the tag matches your corresponding viewholder class)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!