Это мой getView()
.
Я, очевидно, делаю что-то не так, потому что элемент FIRST моего списка всегда не показывает изображение.
Проблема здесь в 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;
}