WebView This control is a very important control in the Android system, and it will not cause the situation mentioned by the original poster. What the original poster may see is the surface display. WebView这个控件作为Android系统中很重要的一个控件,其不会出现楼主所说的情况的。楼主可能看到的是表面显示。
After calling WebView's loadUrl(String url), WebView starts loading the web page, but when it is not loaded, it will It still displays its original white background, and the web page will not be displayed until it is loaded. This may mean that the display goes blank and it takes a while before the web page can be opened. In fact, it is loading all the time, but it is loading slowly and you can't see any changes. 🎜
🎜The author can use WebView.setWebViewClient to pass in a customized WebViewClient. There is also WebView.setWebChromeClient. Override some of these functions: 🎜
rrreee
🎜If the poster configures WebView as above, and then in loadUrl(String url), you can see the callbacks of these functions. The content in the question can be answered from Log. 🎜
This is indeed the case, I have also encountered it, and found that if you do not call wv_viewerweb.removeAllViews(); // wv_viewerweb.destroy(); // wv_viewerweb = null; this problem will not occur
WebView
This control is a very important control in theAndroid
system, and it will not cause the situation mentioned by the original poster. What the original poster may see is the surface display.WebView
这个控件作为Android
系统中很重要的一个控件,其不会出现楼主所说的情况的。楼主可能看到的是表面显示。当调用
WebView
的loadUrl(String url)
之后,WebView
就开始加载网页了,但是在没有加载出来的时候,它会仍然显示着其原有的白色背景,加载出来后才会显示网页。这可能是你说的显示一片空白,然后过一会才能打开网页。其实一直都在加载,只是加载比较慢,你看不出来有变化而已。楼主可以使用
WebView.setWebViewClient
,传入一个自定义的WebViewClient
。同样还有WebView.setWebChromeClient
。覆写其中一些函数:楼主如果对
After callingWebView
进行如上的配置,然后在loadUrl(String url)
,就能看到这些函数的回调了。问题里的内容都可以从Log
WebView
'sloadUrl(String url)
,WebView
starts loading the web page, but when it is not loaded, it will It still displays its original white background, and the web page will not be displayed until it is loaded. This may mean that the display goes blank and it takes a while before the web page can be opened. In fact, it is loading all the time, but it is loading slowly and you can't see any changes. 🎜 🎜The author can useWebView.setWebViewClient
to pass in a customizedWebViewClient
. There is alsoWebView.setWebChromeClient
. Override some of these functions: 🎜 rrreee 🎜If the poster configuresWebView
as above, and then inloadUrl(String url)
, you can see the callbacks of these functions. The content in the question can be answered fromLog
. 🎜1. I really encountered this situation yesterday
2. Analysis of the reasons: A. I suggest the poster use Charles to capture the packets
This is indeed the case, I have also encountered it, and found that if you do not call wv_viewerweb.removeAllViews();
// wv_viewerweb.destroy();
// wv_viewerweb = null; this problem will not occur
Is the problem solved? ? ? I also fell into a trap, please give me a solution...