简体   繁体   中英

WebView how to get local res\drawable-hdpi image path

I have a WebView and I want to add a backgroung Image

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.

Thx.

将您的图片放入素材资源文件夹,您可以像这样将其用于图片标签

<img src="file:///android_asset/images/yourimage.png">

In xml use

android:background="@+drawable/bgrnd.png"

Set mWebView.setBackgroundColor(0); below your string

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM