Using webView's loadDataWithBaseURL not loading images from sdcard

前端 未结 2 896
终归单人心
终归单人心 2021-01-23 21:26

I would like to set some html content in my webview with some pictures. I\'ve read on the internet i must use loadDataWithBaseUrl to do such a thing because i need to link the f

相关标签:
2条回答
  • 2021-01-23 22:31

    You have a syntax error in your loading statement. You have to put : after file

    myWebView.loadDataWithBaseURL("file:///mnt/sdcard/com.mypackage.myproject/3", myHtml, "text/html", "utf-8", "");
    
    0 讨论(0)
  • 2021-01-23 22:33

    You don't need to put full path of your image into html.

    img src="images/test1.jpg"

    Instead

    img src=\""+ imagePath + "\"

    0 讨论(0)
提交回复
热议问题