0

我之前已经完成了大量的 ListViews 异步加载图像。但是这个有点落后

我在日志中得到了这个,然后它给出了一个小的延迟

09-19 21:13:32.980: I/endeffect(23824): AbsListView.onMeasure(), getWidth()=1080, getHeight()=561, this=android.widget.ListView{43c94550 VFED.VC. ......ID 0,120-1080,681 #7f0501c1 app:id/sliding_drawer_lv}

这是代码:

public View getView(int position, View convertView, ViewGroup parent) {
    final ViewHolder mViewHolder;
    long ts = System.currentTimeMillis();
    if(convertView==null){
        convertView = inflater.inflate(R.layout.list_item_routes_search, null);

        mViewHolder = new ViewHolder();
        mViewHolder.pictureNIV = (NetworkImageView)convertView.findViewById(R.id.my_fav_route_image_iv);
        mViewHolder.pictureNIV.setVisibility(View.GONE);

        mViewHolder.titleTv=(TextView)convertView.findViewById(R.id.my_fav_route_item_title_tv);
        mViewHolder.eventTv=(TextView)convertView.findViewById(R.id.my_fav_route_item_event_tv);
        mViewHolder.createdTv=(TextView)convertView.findViewById(R.id.my_fav_route_item_created_tv);
        mViewHolder.createdTv=(TextView)convertView.findViewById(R.id.my_fav_route_item_created_tv);
        App.setFont('m', mViewHolder.titleTv,mViewHolder.eventTv);
        App.setFont('l', mViewHolder.createdTv);

        mViewHolder.extraViewLL= (LinearLayout) convertView.findViewById(R.id.my_fav_route_item_extra_ll);
        mViewHolder.contentViewLL = (LinearLayout) convertView.findViewById(R.id.my_fav_route_item_content_ll);
        mViewHolder.closeBtn = (Button) convertView.findViewById(R.id.my_fav_route_item_close_btn);
        mViewHolder.favoriteTb = (ToggleButton)convertView.findViewById(R.id.my_fav_route_item_extra_fav_tb);
        mViewHolder.shareBtn = (Button)convertView.findViewById(R.id.my_fav_route_item_extra_share_btn);
        mViewHolder.rlp = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);

        convertView.setTag(mViewHolder);
    }
    else{
        mViewHolder = (ViewHolder) convertView.getTag();
    }

然后我使用 Volleys NetworkImageView 设置图像,但我也尝试了带延迟的 Aq:

mViewHolder.pictureNIV.setImageUrl(getItem(position).images.getImageNormal(),App.mVolleyImageLoader);
4

1 回答 1

0

ListView 的高度设置为 wrap_parent。这显然花费了视图来重新调整它自己。

于 2013-09-19T20:05:46.010 回答