@Eldhose M Babu 和@ankitmakwana:我用过它,但我不确定其中缺少什么。我已附上代码,请查看并指导我:
mWebview.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
mWebview.setVisibility(View.GONE);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
mWebview.setVisibility(View.VISIBLE);
mWebview.requestFocus();
}
public void onLoadResource(WebView view, String url) {
mWebview.loadUrl("javascript:(function() { "
+ "document.getElementsByTagName('header')[0].style.display = 'none'; "
+ "})()");
mWebview.loadUrl("javascript:(function() { "
+ "document.getElementsByTagName('footer')[0].style.display = 'none'; "
+ "})()");
mWebview.loadUrl("javascript:(function() { "
+ "document.getElementsByTagName('section').search_again.style.display = 'none'; "
+ "})()");
}
});
mWebview.loadUrl("http://search.yahoo.com/mobile/s?submit=oneSearch&.intl=us&.lang=en&.tsrc=yahoo&.sep=fp&x=0&y=0&p=bike");
setContentView(mWebview);