java Android“setToolbarColor(int)”和“setSecondaryToolbarColor(int)”不推荐使用
我使用此代码打开带有Chrome自定义选项卡的链接。但是它显示了@Deprecated
对于setToolbarColor()
和setSecondaryToolbarColor()
。我还没有找到任何替代品
注意:Android studio建议“改用setDefaultColorSchemeParams。”但还没有找到任何这样的例子
Uri uri = Uri.parse(url);
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
intentBuilder.setToolbarColor(ContextCompat.getColor(activity,R.color.background));
intentBuilder.setSecondaryToolbarColor(ContextCompat.getColor(activity,R.color.background));
intentBuilder.setStartAnimations(activity,R.anim.slide_in_right,R.anim.slide_out_left);
intentBuilder.setExitAnimations(activity,安卓.R.anim.slide_in_left,安卓.R.anim.slide_out_right);
CustomTabsIntent customTabsIntent = intentBuilder.build();
customTabsIntent.launchUrl(activity,uri);
# 1 楼答案
使用
CustomTabColorSchemeParams
代替:Reference