我的Webview正在加载一个url。加载url需要更多的时间。作为回报,我得到了一张空白页/空白页。这在模拟器中非常有效,但在任何设备中都不行。。请帮我
mWebView = (WebView) mRootView.findViewById(R.id.paymentWebView);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d(TAG, "Processing webview url click...");
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
Log.d(TAG, "Finished loading URL: " + url);
}
}
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
Log.e(TAG, "Error: " + description);
}
});
mWebView.loadUrl("my url to be loaded");
替换:
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d(TAG, "Processing webview url click...");
view.loadUrl(url);
return true;
}
通过
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d(TAG, "Processing webview url click...");
return false;
}