CustomTabsIntent.Builder
public static final class CustomTabsIntent.Builder
extends Object
CustomTabsIntent对象的生成器类。
摘要(Summary)
公共方法(Public methods) |
CustomTabsIntent.Builder |
addDefaultShareMenuItem() 将一个默认的共享项目添加到菜单。 |
CustomTabsIntent.Builder |
addMenuItem(String label, PendingIntent pendingIntent) 添加一个菜单项。 |
CustomTabsIntent.Builder |
addToolbarItem(int id, Bitmap icon, String description, PendingIntent pendingIntent) 此方法已弃用。 使用CustomTabsIntent.Builder#setSecondaryToolbarViews(RemoteViews,int [],PendingIntent)。 |
CustomTabsIntent |
build() 组合所有已设置的选项并返回一个新的 CustomTabsIntent对象。 |
CustomTabsIntent.Builder |
enableUrlBarHiding() 当用户在页面上向下滚动时,启用url栏。 |
CustomTabsIntent.Builder |
setActionButton(Bitmap icon, String description, PendingIntent pendingIntent, boolean shouldTint) 设置工具栏中显示的操作按钮。 |
CustomTabsIntent.Builder |
setActionButton(Bitmap icon, String description, PendingIntent pendingIntent) 使用默认着色行为设置工具栏中显示的操作按钮。 |
CustomTabsIntent.Builder |
setCloseButtonIcon(Bitmap icon) 设置自定义选项卡的关闭按钮图标。 |
CustomTabsIntent.Builder |
setExitAnimations(Context context, int enterResId, int exitResId) 设置退出动画。 |
CustomTabsIntent.Builder |
setSecondaryToolbarColor(int color) 设置辅助工具栏的颜色。 |
CustomTabsIntent.Builder |
setSecondaryToolbarViews(RemoteViews remoteViews, int[] clickableIDs, PendingIntent pendingIntent) 设置自定义选项卡中辅助工具栏中显示的远程视图。 |
CustomTabsIntent.Builder |
setShowTitle(boolean showTitle) 设置标题是否应显示在自定义选项卡中。 |
CustomTabsIntent.Builder |
setStartAnimations(Context context, int enterResId, int exitResId) 设置开始动画。 |
CustomTabsIntent.Builder |
setToolbarColor(int color) 设置工具栏颜色。 |
Public constructors
公共方法(Public methods)
addMenuItem
CustomTabsIntent.Builder addMenuItem (String label,
PendingIntent pendingIntent)
添加一个菜单项。
| 参数(Parameters) |
label |
String: Menu label. |
pendingIntent |
PendingIntent: Pending intent delivered when the menu item is clicked. |
addToolbarItem
CustomTabsIntent.Builder addToolbarItem (int id,
Bitmap icon,
String description,
PendingIntent pendingIntent)
此方法已弃用。
使用CustomTabsIntent.Builder#setSecondaryToolbarViews(RemoteViews,int [],PendingIntent)。
向自定义选项卡添加一个操作按钮。 可以通过此方法添加多个按钮。 如果给定的ID等于TOOLBAR_ACTION_BUTTON_ID ,该按钮将被放置在工具栏上; 如果位图太宽,它将被放到底部栏。 如果ID不是TOOLBAR_ACTION_BUTTON_ID ,它将直接放在辅助工具栏上。 单个意图中允许的工具栏项目的最大数量为getMaxToolbarItems() 。 当每个意图超出该数字时抛出IllegalStateException 。
| 参数(Parameters) |
id |
int: The unique id of the action button. This should be non-negative. |
icon |
Bitmap: The icon. |
description |
String: The description for the button. To be used for accessibility. |
pendingIntent |
PendingIntent: The pending intent delivered when the button is clicked. |
setExitAnimations
CustomTabsIntent.Builder setExitAnimations (Context context,
int enterResId,
int exitResId)
设置退出动画。
| 参数(Parameters) |
context |
Context: Application context. |
enterResId |
int: Resource ID of the "enter" animation for the application. |
exitResId |
int: Resource ID of the "exit" animation for the browser. |
setSecondaryToolbarColor
CustomTabsIntent.Builder setSecondaryToolbarColor (int color)
设置辅助工具栏的颜色。
| 参数(Parameters) |
color |
int: The color for the secondary toolbar. |
setSecondaryToolbarViews
CustomTabsIntent.Builder setSecondaryToolbarViews (RemoteViews remoteViews,
int[] clickableIDs,
PendingIntent pendingIntent)
设置自定义选项卡中辅助工具栏中显示的远程视图。
| 参数(Parameters) |
remoteViews |
RemoteViews: The RemoteViews that will be shown on the secondary toolbar. |
clickableIDs |
int: The IDs of clickable views. The onClick event of these views will be handled by custom tabs. |
pendingIntent |
PendingIntent: The PendingIntent that will be sent when the user clicks on one of the Views in clickableIDs. When the PendingIntent is sent, it will have the current URL as its intent data. |
setShowTitle
CustomTabsIntent.Builder setShowTitle (boolean showTitle)
设置标题是否应显示在自定义选项卡中。
| 参数(Parameters) |
showTitle |
boolean: Whether the title should be shown. |
setStartAnimations
CustomTabsIntent.Builder setStartAnimations (Context context,
int enterResId,
int exitResId)
设置开始动画。
| 参数(Parameters) |
context |
Context: Application context. |
enterResId |
int: Resource ID of the "enter" animation for the browser. |
exitResId |
int: Resource ID of the "exit" animation for the application. |