我的Webview正在加载网址。网址加载需要更多时间。作为回报,我得到一个空白页/白页。这在模拟器中完美运行,但在任何设备中都没有.Pls帮助我
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");
答案 0 :(得分:0)
替换:
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;
}