如何在 Chrome 自定义选项卡 android 中隐藏 url
How to hide url in Chrome custom tab android
我在 android 中实现了新的 Chrome 自定义选项卡 ,我正在使用以下代码打开
Uri uri = Uri.parse("https://akash.plobal.com/ploicy");
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
intentBuilder.setToolbarColor(Color.BLACK);
intentBuilder.setShowTitle(true);
intentBuilder.build().launchUrl(getActivity(), uri);
我需要隐藏 url 在工具栏的标题下方
你不能单独隐藏 url。您只能摆脱整个标题栏,当用户滚动视图时也是如此。为此,请使用
intentBuilder.enableUrlBarHiding();
您可以尝试 setShowTitle(false)
您的自定义标签。
如果您同时控制内容和应用程序,则可以使用 Trusted Web Activities to completely remove the URL bar. You'll need to implement Digital Asset Links 来验证两者的所有权。
如果您不拥有该内容,则无法隐藏标题下方的 URL。 URLs 需要对用户可见,以便他们可以知道他们在哪个站点中。通过从 UI 中删除它,恶意网站可以模仿另一个网站的 UI,这可能会给用户带来安全问题。
我在 android 中实现了新的 Chrome 自定义选项卡 ,我正在使用以下代码打开
Uri uri = Uri.parse("https://akash.plobal.com/ploicy");
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
intentBuilder.setToolbarColor(Color.BLACK);
intentBuilder.setShowTitle(true);
intentBuilder.build().launchUrl(getActivity(), uri);
我需要隐藏 url 在工具栏的标题下方
你不能单独隐藏 url。您只能摆脱整个标题栏,当用户滚动视图时也是如此。为此,请使用
intentBuilder.enableUrlBarHiding();
您可以尝试 setShowTitle(false)
您的自定义标签。
如果您同时控制内容和应用程序,则可以使用 Trusted Web Activities to completely remove the URL bar. You'll need to implement Digital Asset Links 来验证两者的所有权。
如果您不拥有该内容,则无法隐藏标题下方的 URL。 URLs 需要对用户可见,以便他们可以知道他们在哪个站点中。通过从 UI 中删除它,恶意网站可以模仿另一个网站的 UI,这可能会给用户带来安全问题。