网络内容
1、LoadUrl直接显示网页内容(单独显示网络图片)
2、LoadData显示中文网页内容(含空格的处理)
APK包内文件
1、LoadUrl显示APK中Html和图片文件
2、LoadData(loadDataWithBaseURL)显示APK中图片和文字混合的Html内容
res/layout/main.xml
Xml代码
< ?xml version="1.0" encoding="utf-8"?> < LINEARLAYOUT android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> < WEBVIEW android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/webview" /> < /LINEARLAYOUT> < ?xml version="1.0" encoding="utf-8"?> < LINEARLAYOUT android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> < WEBVIEW android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/webview" /> < /LINEARLAYOUT> Example_webview.java
Java代码