Android 在webview和Chrome浏览器上打开链接

Android 在webview和Chrome浏览器上打开链接,android,android-webview,Android,Android Webview,我有一个显示设计模板的web视图,在web视图中有几个链接,当在web视图中单击该方法时,我想用Google Chrome打开这些链接。这个新链接不会打开。但现在,当我点击链接时,它也会在网上的Chrome浏览器中打开。请帮帮我 webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String

我有一个显示设计模板的web视图,在web视图中有几个链接,当在web视图中单击该方法时,我想用Google Chrome打开这些链接。这个新链接不会打开。但现在,当我点击链接时,它也会在网上的Chrome浏览器中打开。请帮帮我

 webView.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            try {
                launchURL(url);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return false;
        }
    });
我的方法:

private void launchURL(String url) {
        CustomTabsIntent.Builder builderCustomTabs = new CustomTabsIntent.Builder();
        CustomTabsIntent intentCustomTabs = builderCustomTabs.build();
        intentCustomTabs.intent.setPackage("com.android.chrome");
        intentCustomTabs.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intentCustomTabs.launchUrl(getActivity(), Uri.parse(url));

}

如果要在移动浏览器中打开链接,可以使用此代码

private void launchURL(String url) {
    Uri uriUrl = Uri.parse(url);
    Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
    startActivity(launchBrowser);
}

我只是在代码中更改这个值

webView.setWebViewClient(new WebViewClient() {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        try {
            launchURL(url);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
});

你在使用android自定义标签吗?标签?什么意思?你是否使用com.android使用此库。支持:customtabs:27.1.1是否要在其他webview或chrome浏览器中打开链接?或者两者都有?