您的位置:首页 > 移动开发

android webView用法

2011-08-31 17:15 183 查看
先讲述一下

webView.loadDataWithBaseURL(url, doc, mimeType, charset, url);

函数原型

void android.webkit.WebView.loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl)Parameters:
baseUrl Url to resolve relative paths with, if null defaults to "about:blank"data A String of data in the given encoding. mimeType The MIMEType of the data. i.e. text/html. If null, defaults to "text/html"encoding The encoding of the data. i.e. utf-8, us-ascii historyUrl URL to use as the history entry. Can be null.
说一下方法遇到的几个问题

1: 如果不写 baseUrl 指定data内的 超链接如果写的是 /开头的uri 的话, 将会无法访问

2:baseUrl 如果写成主机的domain 例如 http://www.google.cn 可以访问 data中的超链接,但是 无法使用 goback

3: 将 baseUrl 与 historyUrl 写成相同的,一切正常
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: