I am building a Tinder-like Android app with this library : https://github.com/Diolor/Swipecards and Picasso for image loading. Everything works fine, except the first view of the list. The image is not displayed, although the text is correct.
Views are stored in a custom subclass of ArrayAdapter. Here is the code:
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
switch (getItemViewType(position)) {
case TYPE_MOVIE:
ViewHolderMovie holder;
if (convertView == null) {
holder = new ViewHolderMovie();
convertView = inflater.inflate(R.layout.movie_card, parent, false);
holder.movieCover = (ImageView)convertView.findViewById(R.id.movieCover);
holder.movieTitle = (TextView)convertView.findViewById(R.id.movieTitle);
holder.movieGenre = (TextView)convertView.findViewById(R.id.movieGenre);
convertView.setTag(holder);
} else {
holder = (ViewHolderMovie) convertView.getTag();
}
Movie movie = (Movie) data.get(position);
Picasso.with(convertView.getContext())
.load(movie.imagePath)
.resize(500, 500)
.into(holder.movieCover); // this doesn't work for the first view
holder.movieTitle.setText(movie.title);
holder.movieGenre.setText("Film au cinéma ("+movie.genre+")");
return convertView;
}
return null;
}
Do you have an idea please?
答案 0 :(得分:0)
检查您的图片网址路径,尤其是斜杠' /'。 毕加索不会在' /'时显示ArrayAdapter的第一张图片。在你的imageurl路径中有两次。 但它会在滚动Gridview或Listview
时真实显示