ListView.Builder中的cacheExtent属性到底能做什么? [英] What exactly does cacheExtent property in ListView.Builder do?
问题描述
作为标题,我想了解关于cacheExtent及其作用的信息.它采用双精度值;我尝试使其等于999999999999999,然后注意到ListView.Builder滚动性能有了很大的提高,所以我需要了解它.
As title I want to know about cacheExtent and what it's doing. It takes double values; I tried to make it equal to 999999999999999 and then I noticed a huge improvement in ListView.Builder scrolling performance, so I need to know about it.
推荐答案
根据文档:
cacheExtent
是在屏幕的可见部分之前绘制的区域的大小,它分为两部分:一个部分在可见区域之前,在该区域中已经显示了项目,另一部分在可见区域之后.
cacheExtent
is the size of the area that is drawn before being in the visible part of the screen, it has two parts : the one before the visible area where items are already displayed, and the other after the visible area.
当您使 cacheExtent
的大小非常大(999999999999999)时,您几乎使 ListView
绘制了当前显示项目前后的所有子项,这就是滞后"的行为消失了.但是您必须明智地使用高速缓存,因为将其设置得很大会导致令人不快的副作用,例如用户互联网流量的显着增加.延迟加载在那里是有原因的.
When you made the size of cacheExtent
very huge (999999999999999) you almost made your ListView
draw all its children before and after the currently displayed items, that's way the "lagging" behavior disappeared. But you have to use the cache wisely, because making it very big will result in unpleasant side effects, like significant increase in internet traffic for your users. Lazy loading is there for a reason.
这篇关于ListView.Builder中的cacheExtent属性到底能做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!