Android WebView未加载新数据

时间:2017-12-31 10:51:52

标签: android webview

我有这个WebView,我从服务器获取HTML。

 String Body = "<html> <head> <style> body { background-color: clear !important; } p,div,span,li { color:black; font-size:17px !important;background-color: clear !important;} embed, iframe, object, video {height: 160px; width: 355.0px;} img { height: 160px; width: 355.0px; } </style> </head> <body><p>" +
                    BodyDetails +
                    "</p>" +
                    "</div></p></body> </html>";

            Log.d("currentContent != null", Body);
            CustomTextViewDetail.getSettings().setJavaScriptEnabled(true);
            CustomTextViewDetail.loadData("", "text/html; charset=utf-8", "UTF-8");
            CustomTextViewDetail.loadData(Body, "text/html; charset=utf-8", "UTF-8");
            CustomTextViewDetail.getSettings().setBuiltInZoomControls(true);
            CustomTextViewDetail.getSettings().setDisplayZoomControls(false);

我的问题是,当我更改HTML内容时,网页视图仍会显示最后一些内容未加载新内容!

如何刷新或解决此问题?

1 个答案:

答案 0 :(得分:0)

更改数据后调用myWebView.reload()