如何从themoviedb api的响应中获取图像



我从themoviedb API获得以下JSON响应:

{
"popularity":1640.159,
"vote_count":32,
"video":false,
"poster_path":"/9Rj8l6gElLpRL7Kj17iZhrT5Zuw.jpg",
"id":734309,
"adult":false,
"backdrop_path":"/7fvdg211A2L0mHddvzyArRuRalp.jpg",
"original_language":"en",
"original_title":"Santana",
"genre_ids":[
28
],
"title":"Santana",
"vote_average":6.3,
"overview":"Two brothers — one a narcotics agent and the other a general — finally discover the identity of the drug lord who murdered their parents decades ago. They may kill each other before capturing the bad guys.",
"release_date":"2020-08-28"
}

我必须使用poster_path,但我无法理解它,因为它只是图像名称,而不是任何路径。我不知道如何从这个poster_path字符串中获取图像。

请帮帮我!当我把网址粘贴到谷歌上时,我一无所获。

根据电影数据库文档,它的格式如下:-

http://image.tmdb.org/t/p/w500/your_poster_path

(从你的问题中选择海报路径,现在你可以通过将其粘贴到浏览器中作为URL来查看图像-http://image.tmdb.org/t/p/w500/9Rj8l6gElLpRL7Kj17iZhrT5Zuw.jpg(

使用Glide或picasso通过以下其他答案来展示它。

您可以使用glide库从服务器获取和显示图像。请检查以下URL
--https://bumptech.github.io/glide/包含如何使用滑翔

Glide
.with(may be context)
.load(url)
.into(your Image View);

最新更新