android中的webview loaddata不会从img src加载图片 [英] webview loaddata in android does not load a picture from img src

查看:530
本文介绍了android中的webview loaddata不会从img src加载图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用loadData方法将一些html内容加载到webview中,但遇到类似这样的内容时:

< a href =http://www.anywebsite .fr />一些文字< / a>< img src =http://www.anotherwebsite.fr/thewantedpicturewidth =1height =1border =0alt =style =border:none!important; margin:0px!important; />

我只在应用程序中得到这个:

一些文字

如果我没弄错,这还应该显示图片?
如果有人有任何领导,谢谢......

I use loadData method to load some html content into a webview, but when it encounters something like this :
<a href="http://www.anywebsite.fr/">some text</a><img src="http://www.anotherwebsite.fr/thewantedpicture" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
I only get this in the application :
some text
And if I'm not mistaken, this should also display the picture ? If someone has any lead, thanks...

推荐答案

如果你看一下 loadData()方法的文档,你会看到它说:

If you look at the documentation for the loadData() method you'll see it says:


通过此机制加载的内容无法从网络加载内容。

Content loaded through this mechanism does not have the ability to load content from the network.

尝试使用 loadDataWithBaseURL()方法

Try using the loadDataWithBaseURL() method instead.

这篇关于android中的webview loaddata不会从img src加载图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆