首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ImageURL和TMdb的问题?

ImageURL和TMdb的问题?
EN

Stack Overflow用户
提问于 2021-01-20 08:14:51
回答 1查看 92关注 0票数 0

我正在写一个程序(为了学习目的)。它基本上是一个recyclerView,播放来自TMdb的流行电影。一切都很好,但我的主要问题是API中的Json代码显示了ImageURL或"Poster_path“,如下所示:

代码语言:javascript
复制
"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贴在这里?它没有像您看到的那样格式化吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-20 08:33:08

首先检查是否要为图像添加完整的URL,应该是"https://image.tmdb.org/t/p/original/srYya1ZlI97Au4jUYAktDe3avyA.jpg"。

  1. 尝试使用毕加索库,添加毕加索的依赖项:

实现‘com.square up.picasso:picasso:2.3.0’

并加入循环再造视图代码如下:

代码语言:javascript
复制
Picasso.with(context).load(IMAGE_PREFIX + movie.getImagePath()).resize(500,500)
            .placeholder(R.drawable.movieplaceholder2)
            .into(holder.movieImage);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65805482

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档