我正在尝试使用以下功能在 WebView 中显示 div
browser.loadData("<html> <head> <body> <H2> HI </H2> " +
"<div id='map_canvas' style='width:20%;height:20%;'></div>" +
" </body> </head> </html>", "text/html", "UTF-8");
但这不会加载 html 页面会给出错误
browser.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url){
System.out.println("URL:::"+url);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
System.out.println("URL:::"+failingUrl+" "+description+" "+errorCode);
Toast.makeText(getApplicationContext(), "Oh no! " + description, Toast.LENGTH_LONG).show();
}
});
显示为您尝试加载的 URL 的响应无效。请告诉我这里有什么问题