这是我的getView()
。
我显然在这里做错了什么,因为我列表中的第一项总是没有显示图片。
这里的问题在于,the convertview
如果我不回收它,就没有问题。
请问我做错了什么??
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView==null) //IF I DELETE THIS IF EVERYTHING OK!!!
convertView = inflater.inflate(R.layout.square, null);
ImageView image = (ImageView) convertView.findViewById(R.id.background_image);
if (data.get(position).isFollowed()) {
int approprieteimage = getApproppreiateImage(data.get(position));
Picasso.with(context).load(approprieteimage).centerCrop().error(R.drawable.no_image_available).transform(new TealTransformation(context)).fit().into(image);
} else {
int approprieteimage = getApproppreiateImage(data.get(position));
Picasso.with(context).load(approprieteimage).centerCrop().error(R.drawable.no_image_available).fit().into(image);
}
AbsListView.LayoutParams layoutParams = new AbsListView.LayoutParams(width / 2, width / 2);
convertView.setLayoutParams(layoutParams);
return convertView;
}