滚动型VS ListView的性能 [英] ScrollView vs ListView Performance

查看:303
本文介绍了滚动型VS ListView的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这种情况我想讨论:

I have this situation I wanted to discuss:

我有一个列表视图,它的目的是显示25家门店。
对于我想要的设计,我有:

I have a listview that it's purpose is show 25 stores. For the design I want I have:

2的布局中,第一个具有:
1店里的大合影(从数据库中下载)。
如果1图标商店属于最受好评的商店名单(该图标是我的应用程序)
1 TextView中(下载的字符串)

2 layouts, the first one has: 1 big photo of the store (downloaded from a database). 1 icon if the store belongs to the best rated stores list (that icon is on my app) 1 textview (downloaded string)

第二个有:
3 textviews。(下载的字符串)

the second has: 3 textviews.(downloaded string)

Everytextview具有自定义字体。

Everytextview has a custom typeface.

,你可以想像,这是每一项艰巨的任务。

As you can Imagine, this is a huge task for each item.

我的主要问题是:

难道我得到一个更好的性能,如果我下载的一切,而不是让一个ListView我填充此数据的滚动视图?

Wouldn't I get a much better performance if I downloaded everything and instead of making a listview I populate a scrollview with this data?

这可能需要多一点以创建布局,但可能会更顺畅滚动还是我错了?

It might take a bit more to create the layout but probably it would be smoother scroll or am I wrong?

推荐答案

您可以做同样的的ListView (下载的一切和显示),但我不认为认为下载一切实际上带来任何性能改进(除非你在谈论的高速缓存)。

You can do the same with ListView (download everything and display), but I don't think that "downloading everything" will actually bring any performance improvements (except you're talking about cache).

滚动型将导致更糟糕的内存性能,你必须创造并保持25次一次。正好相反,的ListView 重复使用相同的意见,而滚动,这将导致大约创造尽可能多的观点,因为它可以在屏幕上显示。

ScrollView will lead to much worse memory performance as you'll have to create and keep 25 views at once. On contrary, ListView reuse the same views while scrolling which will result in creating approximately as much views as it can fit on the screen.

使用滚动型,如果数据集的改变,你必须以某种方式重新装载您25次。在最坏的情况下重新创建所有视图。

With ScrollView, if dataset changes, you have to somehow repopulate your 25 views. In worst case recreating all views.

此外,随着滚动型将你不得不面对一次这可能会给你的噩梦几天在内存中25大照片。

Moreover, going with ScrollView you'll have to deal with 25 big photos in memory at once which will probably give you nightmares for a few days.

这篇关于滚动型VS ListView的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆