2017-06-22 97 views

回答

0

創建一個WebViewClient,並覆蓋shouldOverrideUrlLoading方法。

webview.setWebViewClient(new WebViewClient() { 
    public boolean shouldOverrideUrlLoading(WebView view, String url){ 
     // do your handling codes here, which url is the requested url 
     // probably you need to open that url rather than redirect: 
     view.loadUrl(url); 
     return false; // then it is not handled by default action 
    } 
}); 
相關問題