4
我想添加一个动作按钮ChromeCustomTabs'工具栏,所以我跟着this tutorial铬自定义选项卡显示的工具栏以外的行动按钮
的按钮被添加,但不是出现在工具栏上,它出现在底部活动:
这是我用来创建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));
}
如何获得靠近三个点的工具栏内的动作按钮? 我错过了什么吗?