我正在写一个程序(为了学习目的)。它基本上是一个recyclerView,播放来自TMdb的流行电影。一切都很好,但我的主要问题是API中的Json代码显示了ImageURL或"Poster_path“,如下所示:
"page":1,
"results":[
{
"adult":false,
"backdrop_path":"/srYya1ZlI97Au4jUYAktDe3avyA.jpg",
"genre_ids":[
14,
28,
12
],
"id":464052,
"original_language":"en",
"original_title":"Wonder Woman 1984",
"overview":"Wonder Woman comes into conflict with the Soviet Union during the Cold War in the 1980s and finds a formidable foe by the name of the Cheetah.",
"popularity":2942.16,
"poster_path":"/8UlWHLMpgZm9bx6QYh0NFoq67TZ.jpg",
"release_date":"2020-12-16",
"title":"Wonder Woman 1984",
"video":false,
"vote_average":7.1,
"vote_count":2853
},遗憾的是,我无法在我的应用程序中看到海报,我正在使用幻灯片来显示海报。有人能帮我吗?顺便问一下,我怎么才能把Json贴在这里?它没有像您看到的那样格式化吗?
发布于 2021-01-20 08:33:08
首先检查是否要为图像添加完整的URL,应该是"https://image.tmdb.org/t/p/original/srYya1ZlI97Au4jUYAktDe3avyA.jpg"。
实现‘com.square up.picasso:picasso:2.3.0’
并加入循环再造视图代码如下:
Picasso.with(context).load(IMAGE_PREFIX + movie.getImagePath()).resize(500,500)
.placeholder(R.drawable.movieplaceholder2)
.into(holder.movieImage);https://stackoverflow.com/questions/65805482
复制相似问题