Android webview加载html字符串
- 布局:
<WebView
android:id="@+id/wv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="12dp"
>
</WebView>
- activity使用:
articleWebView = (WebView)findViewById(R.id.wv_content);
// html字符串内容
articleWebView.loadDataWithBaseURL("",xxxxx,"text/html","UTF-8","");