如何从此JSON响应中提取图像并将其显示在列表视图中?
图片网址位于字段对象中:
"results":[
{
"id":"world/2017/sep/24/german-election-merkel-polls-open-amid-fears-over-far-right-afd-surge",
"type":"article",
"sectionId":"world",
"sectionName":"World news",
"webPublicationDate":"2017-09-24T06:44:14Z",
"webTitle":"German election: polls open amid fears over surge of far-right AfD",
"webUrl":"https://www.theguardian.com/world/2017/sep/24/german-election-merkel-polls-open-amid-fears-over-far-right-afd-surge",
"fields":{
"thumbnail":"https://media.guim.co.uk/971aa3d5064bcf656de9d6c775c1012752426821/0_18_3500_2100/500.jpg"
},
"isHosted":false
}
答案 0 :(得分:0)
为此,您需要获得"字段"对象第一。在"领域"对象得到属性"缩略图"并下载图像。或者你可以使用Glide或picasso之类的任何图书馆。
以下是使用滑翔和毕加索的链接。
滑翔:
https://code.tutsplus.com/tutorials/code-an-image-gallery-android-app-with-glide--cms-28207
毕加索:https://code.tutsplus.com/tutorials/android-sdk-working-with-picasso--cms-22149