【发布时间】:2019-12-20 08:50:49
【问题描述】:
我找到了一些从 html img 标签中提取图片链接的代码。它使用 Html Java 库并使用来自 Html 的某些方法。
我从一些 RSS 提要中提取了 html 代码,我想提取并显示图像。我已经完成了下面的代码,但我认为这根本不是优雅的解决方案:
Html.fromHtml(html, new Html.ImageGetter() {
@Override
public Drawable getDrawable(final String source) {
Drawable d = null;
Glide.with(mContext)
.load(source)
.into(img);
sImgUrl = source;
return d;
}
}, null);
是否可以在不覆盖 getDrawable() 的情况下提取此“源”字符串?
【问题讨论】: