【发布时间】:2019-01-17 07:37:00
【问题描述】:
我正在尝试使用 Fresco(我也尝试使用 Glide 和 Picasso)1.10.0 从 URL 加载 Google Play 图书图像缩略图。我可以加载另一张图片(例如 https://i.imgur.com/6zDqjm8.jpg),但是当我使用 Google Play 图书缩略图链接(例如 http://books.google.com/books/content?id=F1wgqlNi8AMC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api)时,只会显示占位符图片。
我还尝试在 Uri.parse 代码中的链接末尾添加“.jpeg”(因为在 Web 浏览器中图像仍然显示),但这并没有什么不同。
您知道这是为什么和/或我做错了什么吗?
我在清单中获得了 INTERNET 权限。我的 XML 文件中还有 Fresco 命名空间。
我的 Fresco 代码(取自 Getting Started with Fresco 指南):
Uri uri = Uri.parse("http://books.google.com/books/content?id=F1wgqlNi8AMC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api");
SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI(uri);
SimpleDraweeView 的 XML 代码:
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/my_image_view"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
fresco:placeholderImage="@drawable/search_white_24dp" />
我正在使用的 JSON(获取更多 Google Play 图书缩略图):https://pastebin.com/hq4AFMRb
如果您需要更多信息(例如 XML),请告诉我。如果可行,我不介意使用其他第三方库(包括 Glide 或 Picasso)。
【问题讨论】: