Directly put html code in a WebView (Android)

后端 未结 3 914
悲&欢浪女
悲&欢浪女 2021-02-06 23:18

While using WebView, we usually put a URL for it:

WebView.loadUrl(myURL);

but it is possible to put HTML code directly?? So that it will be in

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-06 23:55

    Check out this: http://developer.android.com/reference/android/webkit/WebView.html

     // OR, you can also load from an HTML string:
     String summary = "You scored 192 points.";
     webview.loadData(summary, "text/html", null);
    

提交回复
热议问题