首页 > 解决方案 > 如何在 Chrome 自定义标签中使用 getUrl()

问题描述

我正在使用 chrome 自定义标签(webview),但 getUrl() 和 getTitle() 函数不起作用。这个怎么做?

 final CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
                intentBuilder.setToolbarColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary));
                intentBuilder.setShowTitle(false);
                //intentBuilder.setSecondaryToolbarColor(ContextCompat.getColor(getActivity(), R.color.colorPrimaryDark));
                intentBuilder.setExitAnimations(getActivity(), android.R.anim.slide_in_left, android.R.anim.slide_out_right);
                CustomTabsIntent customTabsIntent = intentBuilder.build();
                customTabsIntent.launchUrl(getActivity(), Uri.parse(urll));

标签: androidandroid-fragmentswebview

解决方案


URL 应该是这样的“ https://www.google.co/ ”在 url 之前添加 https


推荐阅读