[英]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.