我有一个仅显示图像的网格视图。
@Override
public View getView(int i, View convertView, ViewGroup viewGroup) {
ViewHolder viewHolder = null;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = mInflater.inflate(R.layout.item_user_image_adapter, null);
viewHolder.imageView = (ImageView) convertView.findViewById(R.id.imageView);
viewHolder.imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
viewHolder.imageView.setLayoutParams(new GridView.LayoutParams(this.width, this.width));
convertView.setTag(viewHolder);
}
else {
viewHolder = (ViewHolder) convertView.getTag();
}
Log.i("XXX", "" + this.data.size());
if (i == this.data.size() - 1)) {
viewHolder.imageView.setImageResource(R.drawable.icon_add_photo);
} else if (this.data.get(i) != null && !this.data.get(i).equals("")) {
**// Option 1**
// Picasso.with(this.context)
// .load(this.data.get(i))
// .placeholder(R.mipmap.default_image_load_fail_user)
// .resize(400, 400)
// .centerCrop()
// .into(viewHolder.imageView);
**// option 2**
// viewHolder.imageView.setImageResource(R.mipmap.default_man);
}
return convertView;
}
private static class ViewHolder {
ImageView imageView;
}
当我使用毕加索时,第一张图像和第二张图像是相同的! 但是当使用option2时,两个图像会以不同方式显示
为什么?//