[英]Android Complex list of items in scrollview Best Practices
I´m developing an app in which I have a list of products, sometimes are a huge list and other times are only one or two items. 我正在开发一个应用程序,其中我有一个产品列表,有时是一个巨大的列表,其他时间只有一两个项目。
I read this items from a local database, right? 我从本地数据库读取这些项目,对吧? ok, when I have about 20 o 30 items, I think the return is very slow, it takes one or two seconds rendering items and I need to know the best practices about that.
好吧,当我有大约20个30项时,我认为返回非常慢,需要一两秒钟渲染项目,我需要知道有关它的最佳实践。 I have tested two ways:
我测试了两种方法:
Is there a better way? 有没有更好的办法? I´m sure yes!
我确定是的!
My items are a little bit complex: image, name, category, provider, price, some buttons with "onclick" listeners, two little icons. 我的项目有点复杂:图像,名称,类别,提供商,价格,一些带有“onclick”听众的按钮,两个小图标。 Everything each item.
每个项目的一切。
It is very important for me to speed up that process. 加速这个过程对我来说非常重要。
you can use listview and use the attr : android:descendantFocusability=”blocksDescendants” 你可以使用listview并使用attr:android:descendantFocusability =“blocksDescendants”
it can make your item widget respond some click or touch 它可以使您的项目小部件响应一些点击或触摸
My first thoughts on what you described are: 我对你所描述的内容的第一个想法是:
This should prevent the slowdown and if you implement it correctly the user won't even know they aren't all loaded. 这应该可以防止速度减慢,如果你正确实现它,用户甚至不知道它们都没有被加载。
I think you need to implement a scroll view type to do this... do some searching for the scrollviewlistener. 我认为您需要实现滚动视图类型来执行此操作...执行一些搜索scrollviewlistener。
It should be pretty straight forward. 它应该很直接。
I found the answer . 我找到了答案 。 Really cool.
真的很酷。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.