简体   繁体   English

当行高不同时,listview会滚动得很乱

[英]listview scrolls quite junky when therre are different row heights

hi i've some problems with listview. 您好,我在Listview中遇到了一些问题。 My list do have very different cell heights, some of them are even bigger then the height of the screen. 我的列表确实有非常不同的单元格高度,其中一些甚至比屏幕的高度还要大。 What I found out, that listview scrolling intepolator has problems with calculating the inertia. 我发现,该listview滚动插入器在计算惯性方面存在问题。 each time when there is big height difference between two cells currently switching in the visible area, the scrolling junks..I've looked into traceview and there actually is not that much of a delay. 每次当当前在可见区域中切换的两个单元之间的高度差异很大时,滚动垃圾就会出现。我已经查看了traceview,实际上并没有那么多延迟。 (there is no line tallet then the 16ms treshold, though there is visible difference), that means it actually does not junk and it is rather only quickly accelerating and deccelerating the scrolling speed. (虽然没有明显的差异,但没有线高,但有16ms的阈值),这意味着它实际上并不垃圾,它只是快速地加速和减速了滚动速度。 (it occurs in exactly the same time as the scrollbar height changes) Does anybody know how to solve this? (它与滚动条高度更改完全同时发生)有人知道如何解决此问题吗? I've read an article from facebook and they apparently had the same issue..There is written they needed to write their own item recycler. 我已经从facebook上阅读了一篇文章,他们显然也遇到了同样的问题。写他们需要编写自己的物品回收器的文章。 I'm kind of aware of that and would like to see some simpler solution.. Sorry for this question being so abstract, but I guess any code is not necessary.. thank you for your help.. 我对此有所了解,并希望看到一些更简单的解决方案。.很抱歉这个问题如此抽象,但是我想任何代码都是不必要的..谢谢您的帮助。

ListViews recycle, the views that have been already inflated. ListViews回收,已经膨胀的视图。 Since in your case the Listview has items which vary in height, it is better to write your own recycler. 由于在您的情况下,Listview的项目高度不同,因此最好编写自己的回收站。

If you have specific categories as in X, Y and Z then you can check the layout type by adding an attribute to the layout as a tag, and inflating conditionally. 如果您具有X,Y和Z中的特定类别,则可以通过将属性作为标记添加到布局并有条件地进行膨胀来检查布局类型。 But the best way to do this is write your own recycler. 但最好的方法是编写自己的回收站。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM