gpt4 book ai didi

java - 电影海报未通过 TheMovieDB 显示

转载 作者:行者123 更新时间:2023-12-02 03:35:22 27 4
gpt4 key购买 nike

我不太确定我错过了什么,但我一直在尝试利用 Picasso 库从 themoviedb API 获取最受欢迎的电影海报以在 GridView 中显示。有人知道我做错了什么吗?

这是我的图像适配器:

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;
}

}

最佳答案

上述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
}
]

提取要显示的电影图像的海报路径使用以下 URL 显示图像 http://image.tmdb.org/t/p/w500/inVq3FRqcYIRl2la8iZikYYxFNR.jpg

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

关于java - 电影海报未通过 TheMovieDB 显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37512575/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com