解决方法:以"http","https"开头的url在本页用webview进行加载,其他链接进行跳转
private class MyWebViewClient extends WebViewClient{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if(url.startsWith("http:") || url.startsWith("https:") ) {
view.loadUrl(url);
return false;
}else{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
}
}

本文介绍了一种使用Android WebView加载特定格式URL的方法。当遇到以'http'或'https'开头的URL时,采用WebView直接加载;对于其他格式的URL,则启动新的应用进行处理。此方法能够有效地分离不同类型的网络资源处理方式。
7847





