Android Development: Using Image From Assets In A WebView's HTML

后端 未结 6 2062
星月不相逢
星月不相逢 2020-11-28 07:37

In my app I\'m making a basic HTML help document. I wanted my app\'s logo in the HTML img tag itself, but I don\'t know how I\'d reference to the logo which will be stored i

6条回答
  •  野性不改
    2020-11-28 08:13

    Put your Logo into the assets directory eg: assets/logo.png

    Then load your html with:

    webView.loadDataWithBaseURL("file:///android_asset/", htmlData, "text/html", "utf-8", null);
    

    Reference your img like:

    
    

提交回复
热议问题