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));
}
如何獲得靠近三個點的工具欄內的動作按鈕? 我錯過了什麼嗎?