Android WebView未加载新数据

问题描述 投票:0回答:1

我有这个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内容时,Web视图仍会显示最后一个内容未加载新内容!

如何刷新或解决这个问题?

android webview
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.