Chrome自定义标签的自定义设置(例如setToolbarColor,开始和退出动画)不起作用

时间:2018-12-29 13:58:43

标签: android chrome-custom-tabs

我是Android新手,正在尝试在Chrome自定义标签中打开链接。我创建了一个功能,可以在Chrome“自定义标签”中打开应用程序上的所有链接:

public static void chromeCustomTab(Context context, String url)
{
    CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
    CustomTabsIntent customTabsIntent = builder.build();
    customTabsIntent.launchUrl(context,Uri.parse(url));
    builder.setToolbarColor(context.getResources().getColor(R.color.colorPrimaryDark));
    builder.setStartAnimations(context, R.anim.slide_in_bottom, R.anim.slide_out_top);
    builder.setExitAnimations(context, R.anim.slide_in_top, R.anim.slide_out_bottom);
}

现在,链接已在“ Chrome自定义标签”中打开,但是所有合并外观均不起作用。 ToolbarColor不变,动画不起作用。 此外,该站点标题在“ Chrome定制”选项卡上不可见,只有基本网址可见。 请帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

在启动url之前添加构建器设置:)