【问题标题】:webview loaddata in android does not load a picture from img srcandroid中的webview loaddata不会从img src加载图片
【发布时间】:2011-02-23 18:38:44
【问题描述】:

我使用 loadData 方法将一些 html 内容加载到 webview 中,但是当它遇到这样的事情时:
<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;" />
我只在应用程序中得到这个:
some text
如果我没记错的话,这也应该显示图片? 如果有人有任何线索,谢谢...

【问题讨论】:

    标签: android webview image src


    【解决方案1】:

    如果您查看documentation for the loadData() method,您会看到它说:

    通过这种机制加载的内容不具备从网络加载内容的能力。

    尝试改用the loadDataWithBaseURL() method。

    【讨论】:

    • 哦,太好了,从我的脑海中溜走这个。我记得很久以前读过这个,哈哈……谢谢
    • 其实它和 loadData() 一样好用,但还是没有显示图片...我不明白为什么...
    【解决方案2】:

    也许你只需要添加

    <uses-permission android:name="android.permission.INTERNET" />
    

    到您的应用清单。

    【讨论】:

      猜你喜欢
      • 2013-11-30
      • 2023-04-02
      • 2016-10-15
      • 1970-01-01
      • 1970-01-01
      • 2021-07-02
      • 2021-04-27
      • 2015-06-16
      • 1970-01-01
      相关资源
      最近更新 更多