[英]WebView how to get local res\drawable-hdpi image path
I have a WebView and I want to add a backgroung Image 我有一个WebView,我想添加一个背景图像
String htmlPage = "<HTML><BODY background=\"bgrnd.png\" TEXT=\"black\">";
the problem is how to get the image path "bgrnd.png" which is saved in res"\\drawable-hdpi" folder. 问题是如何获取保存在res“ \\ drawable-hdpi”文件夹中的图像路径“ bgrnd.png”。
Thx. 谢谢。
将您的图片放入素材资源文件夹,您可以像这样将其用于图片标签
<img src="file:///android_asset/images/yourimage.png">
In xml use 在xml中使用
android:background="@+drawable/bgrnd.png"
Set mWebView.setBackgroundColor(0);
设置
mWebView.setBackgroundColor(0);
below your string 在你的弦下
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.