How to load html string in a webview?

前端 未结 4 712
既然无缘
既然无缘 2020-12-07 22:25

i have a html string containing this:

    
    
      
            


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 22:37

    read from assets html file

    ViewGroup webGroup;
      String content = readContent("content/ganji.html");
    
            final WebView webView = new WebView(this);
            webView.loadDataWithBaseURL(null, content, "text/html", "UTF-8", null);
    
            webGroup.addView(webView);
    

提交回复
热议问题