Home  >  Article  >  Web Front-end  >  Add the wireless Taobao page to android webview and click the baby details link to enter the baby details page. The problem cannot be returned_html/css_WEB-ITnose

Add the wireless Taobao page to android webview and click the baby details link to enter the baby details page. The problem cannot be returned_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:06:18929browse

In the past few days, I have been trying to introduce the wireless Taobao page into the webview. I found that after clicking on the product details to enter the page, I cannot return.
At first, I followed what most people on the Internet said to display the link in the same webview. Page, thus overloading the shouldOverrideUrlLoading method of WebClient

mWebView = (WebView) findViewById(R.id.webView);  mWebView.setWebViewClient(new WebViewClient() {   @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } });
I found that after clicking the baby details link page, I cannot return. I have tried various methods, but it cannot be solved!
Finally, I found that the solution is: there is no need to rewrite the shouldOverrideUrlLoading method of WebClient; you only need to rewrite the onPageStarted method of WebClient, without writing anything in it. The code is as follows:
		mWebView = (WebView) findViewById(R.id.webView);		mWebView.setWebViewClient(new WebViewClient() {			@Override			public void onPageStarted(WebView view, String url, Bitmap favicon) {				super.onPageStarted(view, url, favicon);			}		});		WebSettings webSettings = mWebView.getSettings();		//支持js        webSettings.setJavaScriptEnabled(true);        //支持对网页缩放        webSettings.setSupportZoom(true);        //支持android4.0        webSettings.setBuiltInZoomControls(true);        //默认缩放模式        webSettings.setDefaultZoom(ZoomDensity.CLOSE);        mWebView.setInitialScale(100);        //载入url
mWebView.loadUrl(" http ://m.taobao.com/channel/chn/mobile/tejia_taoke.php?pid=mm_11443354_6190798_21526785");

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn