再会,
我正在尝试使用 Jsoup 检索图像,但我不确定我应该从网站获得什么。我已经使用以下代码从网站读取,并且能够获取图像的特定标题和它链接到的 URL,但不是图像。
我想将此图像设置为ImageView
我在活动中拥有的图像。到目前为止,这是我的代码:
// Get the required stuff from the webpage
Document document = null;
try {
document = Jsoup.connect(URL).get();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Element info = document.select("div.featurebox").first();
// Caption on image
docInfo = info.text();
// URL of image
imageURL = info.attr("data-url");
// Retrieve the actual image
Element featureImage = document.select("div.featurebox-image").first();
// Unsure what to get here
应该注意的是,图像不是以正常img-src
方式存储的。div
我正在看的特定课程是这样的:
<div class="featurebox-image" style="background:url(http://img.mangastream.com/cdn/feature/02.jpg) center center;">
<div class="featurebox-caption">
<strong>History's Strongest Disciple Kenichi <em>544</em></strong> - Witch </div>
</div>
所以我在寻找来自那个 URL 的实际图像。
我该怎么做?
谢谢