[英]How to add a Drawable to WebView
杰森
{
"text": " «Le président du Bloc du Changement et de la Réforme",
"imagepath": "http://www.example.com/dori%20chamoun-saidaonline.jpg"
}
我获取文本并从URL获取图像作为可绘制图像
introtext = jArray.getString("introtext");
和
InputStream is = bufferedHttpEntity.getContent();
Drawable image = Drawable.createFromStream(is, "src");
我的问题是,我想在同一WebView中显示图像和文本。
有什么帮助吗?
Drawable中不需要。 您可以使用WebView的loadData
方法。 例如:
String content="<html><body><img src=\""+image_path+"\" /><br/>"+your_text+"</body></html>";
wview.loadData(content,"text/html",null);
wview
是您的WebView, image_path
是图像路径, your_text
是您的文本(这里没有任何惊喜)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.