java - TMdb 的 ImageURL 问题?
问题描述
我正在编写一个程序(用于学习目的)。它基本上是一个显示来自 TMdb 的热门电影的 recyclerView。一切正常,但我的主要问题是 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
},
遗憾的是我在我的应用程序中看不到海报,我正在使用 Glide 来显示海报。任何人都可以帮助我吗?顺便说一句,我怎样才能在这里粘贴 Json?如您所见,它没有格式化?
解决方案
首先检查您是否正在添加图像的完整 URL,它应该是“https://image.tmdb.org/t/p/original/srYya1ZlI97Au4jUYAktDe3avyA.jpg”
尝试使用毕加索库,添加毕加索的依赖:
实施 'com.squareup.picasso:picasso:2.3.0'
并添加recyclerview的代码如下:
Picasso.with(context).load(IMAGE_PREFIX + movie.getImagePath()).resize(500,500)
.placeholder(R.drawable.movieplaceholder2)
.into(holder.movieImage);
推荐阅读
- alfresco - 无法执行提供的脚本:04070031 访问被拒绝
- sql-server - 在两个值列上透视表
- facebook - 如何在颤动中使用 facebook 执行 Firebase 身份验证
- outlook-addin - Outlook 插件在 windows 2007 和 office 2016 中运行良好,但插件未在 windows 2010 和 office 2016 中加载
- javascript - 模态显示onclick jquery
- python - 有没有办法在 Altair 标准化堆积条形图中显示百分比(0-100%)?
- tensorflow - TFRecords / TensorFlow Serving:将 TFRecords 转换为(GRPC 或 RESTFul)TensorFlow Serving 请求?
- node.js - Node JS - 无法终止使用子进程 Exec 执行的进程
- c# - 调试位于 nuget 包中的 C# 接口实现
- dask - Dask Distributed - 多个客户端相同的持久数据