Android的发展:使用图像从资产在一个web视图的HTML [英] Android Development: Using Image From Assets In A WebView's HTML
本文介绍了Android的发展:使用图像从资产在一个web视图的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用我在做一个基本的HTML帮助文档。 我想我的应用程序的标识在HTML img标签本身,但我不知道我是怎么想引用其将存储在资产的标志。
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 in assets.
这是可能的,如果是的话怎么办?
Is this possible, if so how?
感谢您的帮助!
推荐答案
把你的标志注入资产目录,例如:资产/ logo.png
Put your Logo into the assets directory eg: assets/logo.png
然后加载您的HTML:
Then load your html with:
webView.loadDataWithBaseURL("file:///android_asset/", htmlData, "text/html", "utf-8", null);
引用您的IMG这样的:
Reference your img like:
<img src="logo.png">
这篇关于Android的发展:使用图像从资产在一个web视图的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文