Most visited

Recently visited

CustomTabsIntent.Builder

public static final class CustomTabsIntent.Builder
extends Object

java.lang.Object
    android.support.customtabs.CustomTabsIntent.Builder


CustomTabsIntent对象的生成器类。

摘要(Summary)

Public constructors

CustomTabsIntent.Builder()

创建 CustomTabsIntent.Builder没有关联的对象 CustomTabsSession

CustomTabsIntent.Builder(CustomTabsSession session)

创建与给定的 CustomTabsSession关联的 CustomTabsIntent.Builder对象。

公共方法(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)

设置工具栏颜色。

继承方法(Inherited methods)

From class java.lang.Object

Public constructors

CustomTabsIntent.Builder

CustomTabsIntent.Builder ()

创建 CustomTabsIntent.Builder没有关联的对象 CustomTabsSession

CustomTabsIntent.Builder

CustomTabsIntent.Builder (CustomTabsSession session)

创建与给定CustomTabsSession关联的CustomTabsIntent.Builder对象。 保证Intent将被发送到与会话关联的组件相同的组件。

参数(Parameters)
session CustomTabsSession: The session to associate this Builder with.

公共方法(Public methods)

addDefaultShareMenuItem

CustomTabsIntent.Builder addDefaultShareMenuItem ()

将一个默认的共享项目添加到菜单。

返回(Returns)
CustomTabsIntent.Builder

addMenuItem

CustomTabsIntent.Builder addMenuItem (String label, 
                PendingIntent pendingIntent)

添加一个菜单项。

参数(Parameters)
label String: Menu label.
pendingIntent PendingIntent: Pending intent delivered when the menu item is clicked.
返回(Returns)
CustomTabsIntent.Builder

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.
返回(Returns)
CustomTabsIntent.Builder
抛出异常(Throws)
IllegalStateException

也可以看看:

build

CustomTabsIntent build ()

组合所有已设置的选项并返回一个新的 CustomTabsIntent对象。

返回(Returns)
CustomTabsIntent

enableUrlBarHiding

CustomTabsIntent.Builder enableUrlBarHiding ()

当用户在页面上向下滚动时,启用url栏。

返回(Returns)
CustomTabsIntent.Builder

setActionButton

CustomTabsIntent.Builder setActionButton (Bitmap icon, 
                String description, 
                PendingIntent pendingIntent, 
                boolean shouldTint)

设置工具栏中显示的操作按钮。

这相当于使用 TOOLBAR_ACTION_BUTTON_ID作为ID调用 addToolbarItem(int, Bitmap, String, PendingIntent)

参数(Parameters)
icon Bitmap: The icon.
description String: The description for the button. To be used for accessibility.
pendingIntent PendingIntent: pending intent delivered when the button is clicked.
shouldTint boolean: Whether the action button should be tinted.
返回(Returns)
CustomTabsIntent.Builder

也可以看看:

setActionButton

CustomTabsIntent.Builder setActionButton (Bitmap icon, 
                String description, 
                PendingIntent pendingIntent)

使用默认着色行为设置工具栏中显示的操作按钮。

参数(Parameters)
icon Bitmap
description String
pendingIntent PendingIntent
返回(Returns)
CustomTabsIntent.Builder

也可以看看:

setCloseButtonIcon

CustomTabsIntent.Builder setCloseButtonIcon (Bitmap icon)

设置自定义选项卡的关闭按钮图标。

参数(Parameters)
icon Bitmap: The icon Bitmap
返回(Returns)
CustomTabsIntent.Builder

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.
返回(Returns)
CustomTabsIntent.Builder

setSecondaryToolbarColor

CustomTabsIntent.Builder setSecondaryToolbarColor (int color)

设置辅助工具栏的颜色。

参数(Parameters)
color int: The color for the secondary toolbar.
返回(Returns)
CustomTabsIntent.Builder

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.
返回(Returns)
CustomTabsIntent.Builder

也可以看看:

setShowTitle

CustomTabsIntent.Builder setShowTitle (boolean showTitle)

设置标题是否应显示在自定义选项卡中。

参数(Parameters)
showTitle boolean: Whether the title should be shown.
返回(Returns)
CustomTabsIntent.Builder

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.
返回(Returns)
CustomTabsIntent.Builder

setToolbarColor

CustomTabsIntent.Builder setToolbarColor (int color)

设置工具栏颜色。

参数(Parameters)
color int: Color
返回(Returns)
CustomTabsIntent.Builder

Hooray!