简体   繁体   English

android 中的延迟加载问题

[英]problem with lazy loading in android

i have done lazy loading in my one of activity lazy loading is running perfectly but first time when my screen the second and third position of list is empty but when i scroll the list all items are listing completly in list我已经在我的一个活动中完成了延迟加载延迟加载运行完美但是第一次当我的屏幕列表的第二个和第三个 position 是空的但是当我滚动列表时所有项目都在列表中完整列出

i attached screenshot Please give me some advice!我附上截图请给我一些建议! This is the screen when Activity is loading这是Activity加载时的画面

Yeah, this is because, you are downloading the images in a separate thread.是的,这是因为,您正在单独的线程中下载图像。 So it will eventually take time to download images one by one.因此,最终需要时间来一张一张地下载图像。 And as the thread download's your images one by one it will update your ListView with the downloaded images.随着线程一一下载您的图像,它将使用下载的图像更新您的 ListView。 This is the concept of Lazyloading.这就是延迟加载的概念。 And as they are being downloaded you are storing it in a cache directory too(if I am right).在下载它们时,您也将其存储在缓存目录中(如果我是对的)。 So unless your image is downloaded you will not be able to see a image in your ListView which is a known fact.因此,除非您的图像已下载,否则您将无法在 ListView 中看到图像,这是已知事实。

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

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