列表视图滚动速度慢的问题
这里 ListView 有一点问题。我有一个类似于
TextView 的 ListView
图像视图
文本视图
图像视图
文本视图
...
等等。它有 1000 多个项目,导致滚动速度非常慢。我尝试按照建议提高性能 这里 整体滚动性能确实提高了很多。
然而,另一个问题出现了 - 在一定量的滚动之后(通常几乎立即),视图开始“聚集”,以前的 ImageView-TextView-ImageView 变成了 ImageView-ImageView-TextView 等等。
有什么想法可能是错的吗?预先感谢您的任何帮助!
(PS 一个疯狂的猜测 - 我需要使 ListView 循环(将其想象为一个类似命运之轮的列表),从而覆盖 getCount 以返回硬编码值,并覆盖 getItem 以返回位置 % 项目数。这可能有什么与它有关吗?)
Got a little ListView problem here. I've got a ListView that goes like
TextView
ImageView
TextView
ImageView
TextView
...
and so on. It has 1000+ items in it, resulting in scrolling being really slow. I tried to improve the performance as advised here and the overall scrolling performance really improved A LOT.
However, another problem appeared - after a certain amount of scrolling (usually almost right away), the views start "clustering", what used to be ImageView-TextView-ImageView turns to ImageView-ImageView-TextView and so on.
Any ideas what could be wrong? Thanks in advance for any help!
(P. S. A wild guess - I needed to make the ListView circular (Imagine it as a wheel-of-fortune-like list) and thus overrode the getCount to return hardcoded values and getItem to return position % number of items. Could that have anything to do with it?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当图像与文本具有逻辑连接时,一种可能的方法是将每一对聚合成一个元素并相应地更改适配器。
when the images have a logical connection to the texts a possible approach would be to aggregate each pair into one element and change the adapter accordingly.