简体   繁体   中英

Can you load a local html resource into a WebView?

我可以设计一个html文件,将其存储在资源中并使用WebView调用吗?

You absolute can, you just need to create a folder in an assets directory on the root of your project and you can have the browser load a url like this...

browser.loadUrl("file:///android_asset/UI/mylocalhtmlfile.htm");

Where UI in the above path is a folder under the assets folder.

positive. You can turn android into a mini web-server which means you can make a call like this: localhost:1234/example.html

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