TheMovieDB 不显示电影海报

Movie Poster Not Displaying w/ TheMovieDB

我不太确定我错过了什么,但我一直在尝试使用 Picasso 库从 themoviedb API 中获取最流行的电影海报以显示在网格视图中。有人知道我做错了什么吗?

这是我的 ImageAdapter:

public class ImageAdapter extends BaseAdapter {

    private Context mContext;

    public ImageAdapter(Context c) {
        mContext = c;
    }

    public int getCount() {
        return 20;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    // create a new ImageView for each item referenced by the Adapter
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {
            // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            Picasso.with(mContext).load("https://api.themoviedb.org/3/movie/popular?api_key={APIKEY_HERE}&poster_path&images").into(imageView);
        } else {
            imageView = (ImageView) convertView;
        }

        return imageView;
    }

} 

你必须检查 url in picasso 它 returns 整个数据而不是图像 url,尝试将 poster_path 的值添加到右边 url

上面提到的API将给出热门电影列表..

results: [
{
poster_path: "/inVq3FRqcYIRl2la8iZikYYxFNR.jpg",
adult: false,
overview: "life.",
release_date: "2016-02-09",
backdrop_path: "/nbIrDhOtUpdD9HKDBRy02a8VhpV.jpg",
popularity: 91.92864,
vote_count: 3497,
video: false,
vote_average: 7.2
}
]

提取poster_path您要显示的电影图像 使用下面的URL显示图片http://image.tmdb.org/t/p/w500/inVq3FRqcYIRl2la8iZikYYxFNR.jpg

您可以在此处找到文档 http://docs.themoviedb.apiary.io/#reference/configuration/configuration