我的 webview android 浏览器无法正确加载 facebook 页面。在本机浏览器上,它看起来像这样:
但我WebView
喜欢这样:
我不知道是什么原因,这是我的代码:
web = (WebView) findViewById(R.id.webView);
web.getSettings().setLoadWithOverviewMode(true);
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setPluginsEnabled(true);
web.getSettings().setLoadsImagesAutomatically(true);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
web.getSettings().setCacheMode(WebSettings.LOAD_NORMAL);
web.getSettings().setSupportZoom(true);
web.getSettings().setBuiltInZoomControls(true);
web.setNetworkAvailable(true);
web.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView web, int progress) {
if (progress < 100
&& progressBar.getVisibility() == ProgressBar.GONE
&& isConnected) {
progressBar.setVisibility(ProgressBar.VISIBLE);
textProgress.setVisibility(ProgressBar.VISIBLE);
}
if (progress < 100
&& progressBar.getVisibility() == ProgressBar.VISIBLE
&& textProgress.getVisibility() == ProgressBar.VISIBLE) {
textProgress.setText(String.format(getResources()
.getString(R.string.browser_loading), progress));
}
if (progress >= 100) {
progressBar.setVisibility(ProgressBar.GONE);
textProgress.setVisibility(ProgressBar.GONE);
}
}
});
if (isConnected) {
web.setWebViewClient(new WebViewClient() {
public void onPageStarted(WebView view, String url, Bitmap map) {
return;
}
public boolean shouldOverrideUrlLoading(WebView view, String url) {
web.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
}
});
web.loadUrl(url);
请帮忙 :)