Directly put html code in a WebView (Android)

后端 未结 3 924
悲&欢浪女
悲&欢浪女 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:45

     String yourhtmlpage = "You scored hello world points.";
     webview.loadDataWithBaseURL(null, yourhtmlpage, "text/html", "UTF-8", null);
    

提交回复
热议问题