Android webview加载html字符串

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",""); 
发布了5 篇原创文章 · 获赞 1 · 访问量 455

猜你喜欢

转载自blog.csdn.net/weixin_42716507/article/details/100882681