我的WebView在Android 2.3中完美运行,但在我的Nexus S 4.0上,页面无法正常加载。背景颜色加载但没有别的。
4.0有什么变化?
感谢或者我能得到任何帮助!
我的WebView代码:
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon){ super.onPageStarted(view, url, favicon);
webView.clearCache(true);
}
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Toast.makeText(Home.this, description, Toast.LENGTH_SHORT).show();
}
});
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Hide/Show loading animation
}
@Override
public void onConsoleMessage(String message, int lineNumber, String
super.onConsoleMessage(message, lineNumber, sourceID);
}
});
// SETUP WEBVIEW
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webView.setInitialScale(1);
webView.scrollBy(0, 0);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setBackgroundColor(0x333333);
webView.getSettings().setRenderPriority(RenderPriority.HIGH);
webView.loadUrl(urlButton1);
// Test
webView.clearSslPreferences();
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
答案 0 :(得分:1)
只需删除webView.setInitialScale(1);
它不适用于ICS