Reputation: 148
I have problem with a android application showing a web page in a native application with webview. The webview dont show some elements of the web page but the web browser show correctly the page. The webview use the same render enginer that android browser? it have the same features that the browser? Im using level 8 sdk with a Galaxy S2. Mi code:
browse = (WebView) findViewById(R.id.webView1);
browse.getSettings().setJavaScriptEnabled(true);
browse.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
//Util.alerta("mensaje p"+progress, Meganoticias.this);
if(progress == 100)
Meganoticias.pd.dismiss();
}
});
browse.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
// Handle the error
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
browse.loadUrl(myurl);
Upvotes: 0
Views: 912
Reputation: 5033
Add these attributes to support with the same effect as of browsers
browse.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
browse.getSettings().setUseWideViewPort(true);
browse.getSettings().setSupportZoom(true);
browse.getSettings().setBuiltInZoomControls(true);
browse.getSettings().setUserAgentString("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3");
Upvotes: 2