安卓列表视图
我在我的应用程序中使用列表视图,并且该视图动态增长。最初列表包含整个列表行的相同内容。列表视图中的每一行随着应用程序的进度显示不同的内容。我使用相同的列表视图来显示两种类型的内容。但问题是,当发生这种情况时,列表视图的滚动变得不太平滑。请告诉我为什么会发生这种情况。
提前致谢。
I'm using a list view in my app and which grows dynamically. Initially list contains same contents for entire list row. Each row in list view displays different contents as app progress. I used same list view foe displaying two type of contents. But the problem is when this happens the scrolling of list view become less smooth. please tell me why this happens.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无论如何,如果不查看代码就很难判断问题出在哪里,您是否在该列表视图中使用远程图像?或者您使用基本或数组适配器创建的自定义列表视图?如果是,那么您肯定会遇到与性能相关的问题。
it is hard to tell what the problem is without looking at the code anyways are you using remote images in that listview? or custom listview you have created using base or arrayadapter? if yes then you will have definately perfomance related issue.
到目前为止,我所看到的最可能的原因是每次请求时都重新创建视图。您应该查看处理程序上的当前视图是否尚未创建。如果已创建,只需更新它,不要重新创建它。如果不是,那就用新的东西从头开始。
基本的 Android 列表教程中有一些内容,例如(我记不太清了):
密切关注它。
希望这有帮助。
The most likely cause I've seen for this so far, is re-creating your View every time it's requested. You should rather see if the current View on your Handler is not created already. If it's created just update it, don't re-create it. If it's not then bring it from the scratch with new and all that stuff.
Basic Android List tutorials have some lines like (I can't remember exactly):
Pay close attention to it.
Hope this helps.