Answer the question
In order to leave comments, you need to log in
QML loading html code in webview?
There is html code (htmlCode), resources referenced by the code are located at "assets:/res"
code and resources are added to the WebView in this way:
But the resources (images) are not displayed.
How to fix it?
Ps The program must work on Android WebView.loadHtml(htmlCode, "assets:/res")
Answer the question
In order to leave comments, you need to log in
Links to images from assets should look like file:///android_asset/YourAssetFilename
Example :
String sHtmlTemplate = "<html><head></head><body><img src=\"file:///android_asset/img/mybadge.png\"></body></html>";
webView.loadDataWithBaseURL(null, sHtmlTemplate, "text/html", "utf-8",null);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question