gpt4 book ai didi

android - ListView 图像加载使用 Aquery

转载 作者:行者123 更新时间:2023-11-30 01:04:04 25 4
gpt4 key购买 nike

我正在使用 android 查询库,但它无法在 ListView 中加载图像,

那么,是否有可用的链接或源代码来使用查询并在 ListView 中正确加载图像。

最佳答案

public Onadapter(Context context,String[] id,String[] label,String[] title,String[] image,String[] hrs,String[] posted_date)
{
this.context=context;
this.id = id;
this.label = label;
this.title = title;
this.image = image;
this.hrs = hrs;
this.posted_date=posted_date;
}

private class ViewHolder{
ImageView img;
TextView id;
TextView label;
TextView title;
TextView hrs;
TextView posted_date;

}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;

LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.whatslist, null);
holder = new ViewHolder();
holder.id=(TextView) convertView.findViewById(R.id.whats_id);
holder.img = (ImageView) convertView.findViewById(R.id.thumb1);
holder.label= (TextView) convertView.findViewById(R.id.label);
holder.title = (TextView) convertView.findViewById(R.id.artist_e_desc);
holder.hrs = (TextView) convertView.findViewById(R.id.hrs);
holder.posted_date = (TextView) convertView.findViewById(R.id.date);

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

holder.id.setText(id[position]);
holder.label.setText(label[position]);
holder.title.setText(title[position]);
holder.hrs.setText(hrs[position]);
holder.posted_date.setText(posted_date[position]);
imgaq = new AQuery(convertView);
imgaq.id(holder.img).image(image[position], true, true, 0, 0, null, AQuery.FADE_IN_NETWORK, 1.0f);
return convertView;
}

@Override
public int getCount() {
// TODO Auto-generated method stub
return image.length;
}

@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}

@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
}

关于android - ListView 图像加载使用 Aquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39054272/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com