android WebView渲染html
2015-01-20 14:39
295 查看
xml文件中:
<WebView
android:id="@+id/wv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/hello"/>
java文件中:
WebView
webView= (WebView) this.findViewById(R.id.wv);
//要解析的HTML字符串
final String htmlText = "<html>" +
"<head></head>" +
"<body>" +
"<br/>" +
"<table align="center" border="0" cellspacing="15">" +
"<tr align="center"><td><img src="file:///android_asset/edict.png" /></td>" +
"<td>" +
"<b><font size="5">" + vStr +"</font></b><br/>" + vNum +
"</td></tr>" +
"</table>" +
" " +
"</body></html>";
//最后一击!
webView.loadDataWithBaseURL("about:blank",
htmlText, "text/html", "utf-8", null);
<WebView
android:id="@+id/wv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/hello"/>
java文件中:
WebView
webView= (WebView) this.findViewById(R.id.wv);
//要解析的HTML字符串
final String htmlText = "<html>" +
"<head></head>" +
"<body>" +
"<br/>" +
"<table align="center" border="0" cellspacing="15">" +
"<tr align="center"><td><img src="file:///android_asset/edict.png" /></td>" +
"<td>" +
"<b><font size="5">" + vStr +"</font></b><br/>" + vNum +
"</td></tr>" +
"</table>" +
" " +
"</body></html>";
//最后一击!
webView.loadDataWithBaseURL("about:blank",
htmlText, "text/html", "utf-8", null);
相关文章推荐
- 也谈Android中WebView与HTML的JavaScript交互 推荐
- android webview读取html和js .
- Android中WebView载入本地HTML代码并实现Java与JavaScript交互的例子
- Android的webview加载本地html、本apk内html和远程URL
- Android的webview加载本地html、本apk内html和远程URL
- android webview读取html和js
- Android WebView加载HTML表单并通过javascript提交
- Android的webview加载本地html、本apk内html和远程URL
- Android WebView显示HTML时右边有空白
- android的webview访问本地html,url
- Android中WebView载入本地HTML代码并实现Java与JavaScript交互
- Android的webview加载本地html、本apk内html和远程URL
- android webview显示HTML代码
- Android(3)——webview加载本地html、本apk内html和远程URL
- Android的webview加载本地html、本apk内html和远程URL
- 在本地UI使用webview,在html页面用js与android通信方法。
- Android 小发现:WebView 显示HTML文本,个别字符出现乱码!
- Android的webView中获得Html代码
- Android采用HTML设计软件界面webview
- android webview 正常显示 Html中的 Frameset iframe