android 自定义标签栏,android – Chrome自定义标签显示工具栏外的操作按钮

我想在ChromeCustomTabs的工具栏中添加一个操作按钮,所以我按照

this tutorial进行操作

该按钮已添加,但它不会显示在工具栏中,而是显示在活动的底部:

5eeef0a07ec3fac13ede874e562aedf5.png

这是我用来创建Chrome自定义标签的代码:

private static void openUrlInChromeCustomTab(String webUrl, Activity activity, Item item) {

if (!(webUrl.startsWith("http:") || webUrl.startsWith("https:"))) {

webUrl = "http://" + webUrl;

}

CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();

Bitmap largeIcon = BitmapFactory.decodeResource(activity.getResources(), R.drawable.ic_share);

Product product = (Product) item;

PendingIntent pendingIntent;

Intent intent = new Intent();

intent.setClass(activity, SharingDummyActivity.class);

Bundle bundle = new Bundle();

bundle.putSerializable(SharingDummyActivity.PRODUCT_CRITERIA, product);

intent.putExtras(bundle);

pendingIntent = PendingIntent.getActivity(activity, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

//builder.setActionButton(largeIcon, activity.getResources().getString(R.string.custom_tag_share_description), pendingIntent ,true);

builder.setActionButton(largeIcon, activity.getResources().getString(R.string.custom_tag_share_description), pendingIntent);

CustomTabsIntent customTabsIntent = builder.build();

customTabsIntent.launchUrl(activity, Uri.parse(webUrl));

}

如何让工具栏内的动作按钮靠近三个点?

我错过了什么吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值