You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.
在使用
Page
无限循环时发现一个复用的问题:问题描述:比如我在每个Item里放了一个Text控件和Image控件,现数据源有两个Item:第一个Item只设置了文字,第二个Item只设置了图片。当加载显示后,第一个和第二个都正常显示,但滑动到第三个时(也就是循环回来的第一个),图片和文字却同时显示了。
原因分析:跟了一下源代码发现,当滑动到第三个Item时,该Item使用的ViewHolder会复用前面的,而且复用的ViewHolder没有清空旧数据,这样导致了旧数据和新数据都显示在了一个Item的ViewHolder上,所以图片和文字都同时显示了。
解决方案:我目前的解决方案是找到
PageView
的add(int pos, int index)
方法,修改成如下代码:但这样修改会有一个问题:我每次都重新创建ViewHolder,并不会复用了,这样有一定的性能问题,希望官方合理地解决这个bug。
The text was updated successfully, but these errors were encountered: