更快的加载的ListView,比Viewholder方法快 [英] Faster loading ListView, faster than the Viewholder method

查看:75
本文介绍了更快的加载的ListView,比Viewholder方法快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当为一个ListView膨胀的观点,是它更好地都textViews没有安卓文本.xml文件,多少也影响了速度?那么ViewStubs,那又是更快?

When inflating views for a listView, is it better to have all textViews without android:text in the .xml file and how much does that affects the speed? What about ViewStubs, would that be even faster?

当充气8 textViews没有Android的一个的LinearLayout:文本,并与Android:文本=@字符串/ ABC,这是否能改变什么? 请注意,我再利用的观点,也许只有10送充气,然后再用我不知道。

When inflating a LinearLayout with 8 textViews without android:text and with android:text="@string/abc", does that change anything ? note that i am reusing views, so maybe only 10 get inflated and then reused i don't know.

我正在开发一个中兴之刃,因此that'a单600Mhz的CPU,而不是一个四核...

I am developing on a ZTE Blade, so that'a single 600Mhz CPU and not a quad core ...

推荐答案

您可以试试这个,不知道这是否会加快,但给它一个镜头。

You can try this, not sure if it will speed up, but give it a shot.

在充气后台线程布局。

Inflate the layout in a background thread.

View getView(int position, View convertView, ...) {
    View v;
    if (convertView == null) {
        Start a background thread to inflate your linearLayout. 
        Pass item data and view 'v' to it.

        v = inflate a simple dummy textview;
        return v;
    }
    set normal stuff to convertview here.
    return convertView ;
 }

在后台线程,

  • 充气的LinearLayout中成'V'
  • 设置中的所有数据。
  • 然后在视图无效 v

v.postInvalidate();

这篇关于更快的加载的ListView,比Viewholder方法快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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