CustomTabsIntent.Builder
public final class CustomTabsIntent.Builder
Builder class for CustomTabsIntent objects.
Summary
Public constructors |
|---|
Builder()Creates a |
Builder(@Nullable CustomTabsSession session)Creates a |
Public methods |
|
|---|---|
@NonNull CustomTabsIntent.Builder |
Adds a custom content action that can be invoked by the user on specific content types (image or link) within the Custom Tab. |
@NonNull CustomTabsIntent.Builder |
This method is deprecated. Use |
@NonNull CustomTabsIntent.Builder |
addMenuItem(@NonNull String label, @NonNull PendingIntent pendingIntent)Adds a menu item. |
@NonNull CustomTabsIntent.Builder |
This method is deprecated. Use CustomTabsIntent.Builder#setSecondaryToolbarViews(RemoteViews, int[], PendingIntent). |
@NonNull CustomTabsIntent |
build()Combines all the options that have been set and returns a new |
@NonNull CustomTabsIntent.Builder |
This method is deprecated. Use |
@NonNull CustomTabsIntent.Builder |
setActionButton(Sets the action button that is displayed in the Toolbar with default tinting behavior. |
@NonNull CustomTabsIntent.Builder |
setActionButton(Sets the action button that is displayed in the Toolbar. |
@NonNull CustomTabsIntent.Builder |
setActivitySideSheetBreakpointDp(@Dimension(unit = 0) int breakpointDp)Sets the Custom Tab Activity's transition breakpoint in DP. |
@NonNull CustomTabsIntent.Builder |
setActivitySideSheetDecorationType(int decorationType)Sets the Custom Tab Activity's decoration type that will be displayed when it is acting as a side sheet. |
@NonNull CustomTabsIntent.Builder |
setActivitySideSheetMaximizationEnabled(boolean enabled)Enables or disables the maximization button for when the Custom Tab Activity is acting as a side sheet. |
@NonNull CustomTabsIntent.Builder |
setActivitySideSheetPosition(int position)Sets the Custom Tab Activity's position when acting as a side sheet. |
@NonNull CustomTabsIntent.Builder |
setActivitySideSheetRoundedCornersPosition(int roundedCornersPosition)Sets the Custom Tab Activity's rounded corners position when it is acting as a side sheet. |
@NonNull CustomTabsIntent.Builder |
setBackgroundInteractionEnabled(boolean enabled)Enables the capability of the interaction with background. |
@NonNull CustomTabsIntent.Builder |
setBookmarksButtonEnabled(boolean enabled)Enables or disables the bookmarks button in the overflow menu. |
@NonNull CustomTabsIntent.Builder |
setCloseButtonEnabled(boolean enabled)Sets whether to enable the close button for custom tab. |
@NonNull CustomTabsIntent.Builder |
setCloseButtonIcon(@NonNull Bitmap icon)Sets the Close button icon for the custom tab. |
@NonNull CustomTabsIntent.Builder |
setCloseButtonPosition(int position)Sets the position of the close button. |
@NonNull CustomTabsIntent.Builder |
setColorScheme(int colorScheme)Sets the color scheme that should be applied to the user interface in the custom tab. |
@NonNull CustomTabsIntent.Builder |
setColorSchemeParams(Sets |
@NonNull CustomTabsIntent.Builder |
Sets the default |
@NonNull CustomTabsIntent.Builder |
This method is deprecated. Use |
@NonNull CustomTabsIntent.Builder |
setDownloadButtonEnabled(boolean enabled)Enables or disables the download button in the overflow menu. |
@NonNull CustomTabsIntent.Builder |
setEphemeralBrowsingEnabled(boolean enabled)Sets whether to enable ephemeral browsing within the Custom Tab. |
@NonNull CustomTabsIntent.Builder |
setExitAnimations(Sets the exit animations. |
@NonNull CustomTabsIntent.Builder |
setInitialActivityHeightPx(@Dimension(unit = 1) int initialHeightPx)Sets the Custom Tab Activity's initial height in pixels with default resize behavior. |
@NonNull CustomTabsIntent.Builder |
setInitialActivityHeightPx(Sets the Custom Tab Activity's initial height in pixels and the desired resize behavior. |
@NonNull CustomTabsIntent.Builder |
setInitialActivityWidthPx(@Dimension(unit = 1) int initialWidthPx)Sets the Custom Tab Activity's initial width in pixels. |
@NonNull CustomTabsIntent.Builder |
@ExperimentalInitialNavigationCanLeaveBrowserAllows the Custom Tab to forward the initial URL sent to the Custom Tab to the default handling app for that URL instead of loading it (including following any redirects) in the Custom Tab. |
@NonNull CustomTabsIntent.Builder |
setInstantAppsEnabled(boolean enabled)Sets whether Instant Apps is enabled for this Custom Tab. |
@NonNull CustomTabsIntent.Builder |
This method is deprecated. Use |
@NonNull CustomTabsIntent.Builder |
This method is deprecated. Use |
@NonNull CustomTabsIntent.Builder |
setNetwork(@NonNull Network network)Sets the target network |
@NonNull CustomTabsIntent.Builder |
@ExperimentalOpenInBrowserSets the state for the Open in Browser button in the toolbar for this Custom Tab. |
@NonNull CustomTabsIntent.Builder |
Associates the |
@NonNull CustomTabsIntent.Builder |
This method is deprecated. Use |
@NonNull CustomTabsIntent.Builder |
setSecondaryToolbarSwipeUpGesture(@Nullable PendingIntent pendingIntent)Sets the |
@NonNull CustomTabsIntent.Builder |
setSecondaryToolbarViews(Sets the remote views displayed in the secondary toolbar in a custom tab. |
@NonNull CustomTabsIntent.Builder |
setSendToExternalDefaultHandlerEnabled(boolean enabled)Enables sending any redirects off of the initial URL sent to the Custom Tab to default handling apps. |
@NonNull CustomTabsIntent.Builder |
setSession(@NonNull CustomTabsSession session)Associates the |
@NonNull CustomTabsIntent.Builder |
setShareIdentityEnabled(boolean enabled)Allow Custom Tabs to obtain the caller's identity i.e. package name. |
@NonNull CustomTabsIntent.Builder |
setShareState(int shareState)Sets the share state that should be applied to the custom tab. |
@NonNull CustomTabsIntent.Builder |
setShowTitle(boolean showTitle)Sets whether the title should be shown in the custom tab. |
@NonNull CustomTabsIntent.Builder |
setStartAnimations(Sets the start animations. |
@NonNull CustomTabsIntent.Builder |
This method is deprecated. Use |
@NonNull CustomTabsIntent.Builder |
setToolbarCornerRadiusDp(@Dimension(unit = 0) int cornerRadiusDp)Sets the toolbar's top corner radii in dp. |
@NonNull CustomTabsIntent.Builder |
setTranslateLocale(@NonNull Locale locale)Specifies the target locale the Translate UI should be triggered with. |
@NonNull CustomTabsIntent.Builder |
setUrlBarHidingEnabled(boolean enabled)Set whether the url bar should hide as the user scrolls down on the page. |
Public constructors
Builder
public Builder()
Creates a CustomTabsIntent.Builder object associated with no CustomTabsSession.
Builder
public Builder(@Nullable CustomTabsSession session)
Creates a CustomTabsIntent.Builder object associated with a given CustomTabsSession. Guarantees that the Intent will be sent to the same component as the one the session is associated with.
| Parameters | |
|---|---|
@Nullable CustomTabsSession session |
The session to associate this Builder with. |
Public methods
addCustomContentAction
@ExperimentalCustomContentAction
public @NonNull CustomTabsIntent.Builder addCustomContentAction(@NonNull CustomContentAction action)
Adds a custom content action that can be invoked by the user on specific content types (image or link) within the Custom Tab.
The number of actions shown to the user is at the browser's discretion. The browser may choose not to display all the actions provided. Additionally, priority will be based on the order the actions were added, with the earliest added action being given the highest priority.
When the user triggers this action, the browser will send the getPendingIntent associated with this action. The Intent within the PendingIntent will include the current URL of the Custom Tab as its data, EXTRA_TRIGGERED_CUSTOM_CONTENT_ACTION_ID with the ID of this action, EXTRA_CLICKED_CONTENT_TARGET_TYPE with the type of content interacted with, and potentially other contextual extras (e.g., EXTRA_CONTEXT_IMAGE_URL).
| Parameters | |
|---|---|
@NonNull CustomContentAction action |
The |
| Returns | |
|---|---|
@NonNull CustomTabsIntent.Builder |
This Builder. |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if an action with the same ID has already been added. |
public @NonNull CustomTabsIntent.BuilderaddDefaultShareMenuItem()
Adds a default share item to the menu.
addMenuItem
public @NonNull CustomTabsIntent.Builder addMenuItem(@NonNull String label, @NonNull PendingIntent pendingIntent)
Adds a menu item.
| Parameters | |
|---|---|
@NonNull String label |
Menu label. |
@NonNull PendingIntent pendingIntent |
Pending intent delivered when the menu item is clicked. |
public @NonNull CustomTabsIntent.BuilderaddToolbarItem(
int id,
@NonNull Bitmap icon,
@NonNull String description,
@NonNull PendingIntent pendingIntent
)
Adds an action button to the custom tab. Multiple buttons can be added via this method. If the given id equals TOOLBAR_ACTION_BUTTON_ID, the button will be placed on the toolbar; if the bitmap is too wide, it will be put to the bottom bar instead. If the id is not TOOLBAR_ACTION_BUTTON_ID, it will be directly put on secondary toolbar. The maximum number of allowed toolbar items in a single intent is getMaxToolbarItems. Throws an IllegalStateException when that number is exceeded per intent.
| Parameters | |
|---|---|
int id |
The unique id of the action button. This should be non-negative. |
@NonNull Bitmap icon |
The icon. |
@NonNull String description |
The description for the button. To be used for accessibility. |
@NonNull PendingIntent pendingIntent |
The pending intent delivered when the button is clicked. |
| See also | |
|---|---|
getMaxToolbarItems |
build
public @NonNull CustomTabsIntent build()
Combines all the options that have been set and returns a new CustomTabsIntent object.
public @NonNull CustomTabsIntent.BuilderenableUrlBarHiding()
Enables the url bar to hide as the user scrolls down on the page.
setActionButton
public @NonNull CustomTabsIntent.Builder setActionButton(
@NonNull Bitmap icon,
@NonNull String description,
@NonNull PendingIntent pendingIntent
)
Sets the action button that is displayed in the Toolbar with default tinting behavior.
| See also | |
|---|---|
setActionButton |
setActionButton
public @NonNull CustomTabsIntent.Builder setActionButton(
@NonNull Bitmap icon,
@NonNull String description,
@NonNull PendingIntent pendingIntent,
boolean shouldTint
)
Sets the action button that is displayed in the Toolbar.
This is equivalent to calling addToolbarItem with TOOLBAR_ACTION_BUTTON_ID as id.
| Parameters | |
|---|---|
@NonNull Bitmap icon |
The icon. |
@NonNull String description |
The description for the button. To be used for accessibility. |
@NonNull PendingIntent pendingIntent |
pending intent delivered when the button is clicked. |
boolean shouldTint |
Whether the action button should be tinted.. |
| See also | |
|---|---|
addToolbarItem |
setActivitySideSheetBreakpointDp
public @NonNull CustomTabsIntent.Builder setActivitySideSheetBreakpointDp(@Dimension(unit = 0) int breakpointDp)
Sets the Custom Tab Activity's transition breakpoint in DP.
| Parameters | |
|---|---|
@Dimension(unit = 0) int breakpointDp |
The Custom Tab Activity's breakpoint in DP. |
setActivitySideSheetDecorationType
public @NonNull CustomTabsIntent.Builder setActivitySideSheetDecorationType(int decorationType)
Sets the Custom Tab Activity's decoration type that will be displayed when it is acting as a side sheet.
| Parameters | |
|---|---|
int decorationType |
The Custom Tab Activity's decoration type. |
setActivitySideSheetMaximizationEnabled
public @NonNull CustomTabsIntent.Builder setActivitySideSheetMaximizationEnabled(boolean enabled)
Enables or disables the maximization button for when the Custom Tab Activity is acting as a side sheet. The button is disabled by default.
| Parameters | |
|---|---|
boolean enabled |
Whether the maximization button is enabled. |
setActivitySideSheetPosition
public @NonNull CustomTabsIntent.Builder setActivitySideSheetPosition(int position)
Sets the Custom Tab Activity's position when acting as a side sheet.
| Parameters | |
|---|---|
int position |
The Custom Tab Activity's position. |
setActivitySideSheetRoundedCornersPosition
public @NonNull CustomTabsIntent.Builder setActivitySideSheetRoundedCornersPosition(int roundedCornersPosition)
Sets the Custom Tab Activity's rounded corners position when it is acting as a side sheet.
| Parameters | |
|---|---|
int roundedCornersPosition |
The Custom Tab Activity's rounded corners position. |
setBackgroundInteractionEnabled
public @NonNull CustomTabsIntent.Builder setBackgroundInteractionEnabled(boolean enabled)
Enables the capability of the interaction with background. Enables the interactions with the background app when a Partial Custom Tab is launched.
| Parameters | |
|---|---|
boolean enabled |
Whether the background interaction is enabled. |
| See also | |
|---|---|
EXTRA_DISABLE_BACKGROUND_INTERACTION |
setBookmarksButtonEnabled
public @NonNull CustomTabsIntent.Builder setBookmarksButtonEnabled(boolean enabled)
Enables or disables the bookmarks button in the overflow menu. The button is enabled by default.
| Parameters | |
|---|---|
boolean enabled |
Whether the start button is enabled. |
| See also | |
|---|---|
EXTRA_DISABLE_BOOKMARKS_BUTTON |
setCloseButtonEnabled
public @NonNull CustomTabsIntent.Builder setCloseButtonEnabled(boolean enabled)
Sets whether to enable the close button for custom tab. The close button is enabled by default. If the close button is disabled, calls to setCloseButtonIcon or setCloseButtonPosition have no effect.
| Parameters | |
|---|---|
boolean enabled |
Whether the close button is enabled. |
| See also | |
|---|---|
EXTRA_CLOSE_BUTTON_ENABLED |
setCloseButtonIcon
public @NonNull CustomTabsIntent.Builder setCloseButtonIcon(@NonNull Bitmap icon)
Sets the Close button icon for the custom tab. If the close button is disabled (see setCloseButtonEnabled), then calling this function has no effect.
setCloseButtonPosition
public @NonNull CustomTabsIntent.Builder setCloseButtonPosition(int position)
Sets the position of the close button. If the close button is disabled (see setCloseButtonEnabled), then calling this function has no effect.
| Parameters | |
|---|---|
int position |
The desired position. |
setColorScheme
public @NonNull CustomTabsIntent.Builder setColorScheme(int colorScheme)
Sets the color scheme that should be applied to the user interface in the custom tab.
| Parameters | |
|---|---|
int colorScheme |
Desired color scheme. |
setColorSchemeParams
public @NonNull CustomTabsIntent.Builder setColorSchemeParams(
int colorScheme,
@NonNull CustomTabColorSchemeParams params
)
Sets CustomTabColorSchemeParams for the given color scheme. This allows specifying two different toolbar colors for light and dark schemes. It can be useful if COLOR_SCHEME_SYSTEM is set: Custom Tabs will follow the system settings and apply the corresponding CustomTabColorSchemeParams "on the fly" when the settings change. If there is no CustomTabColorSchemeParams for the current scheme, or a particular field of it is null, Custom Tabs will fall back to the defaults provided via setDefaultColorSchemeParams. Example:
CustomTabColorSchemeParams darkParams = new CustomTabColorSchemeParams.Builder()
.setToolbarColor(darkColor)
.build();
CustomTabColorSchemeParams otherParams = new CustomTabColorSchemeParams.Builder()
.setNavigationBarColor(otherColor)
.build();
CustomTabIntent intent = new CustomTabIntent.Builder()
.setColorScheme(COLOR_SCHEME_SYSTEM)
.setColorSchemeParams(COLOR_SCHEME_DARK, darkParams)
.setDefaultColorSchemeParams(otherParams)
.build();| Parameters | |
|---|---|
int colorScheme |
A constant representing a color scheme (see |
@NonNull CustomTabColorSchemeParams params |
An instance of |
setDefaultColorSchemeParams
public @NonNull CustomTabsIntent.Builder setDefaultColorSchemeParams(@NonNull CustomTabColorSchemeParams params)
Sets the default CustomTabColorSchemeParams. This will set a default color scheme that applies when no CustomTabColorSchemeParams specified for current color scheme via setColorSchemeParams.
| Parameters | |
|---|---|
@NonNull CustomTabColorSchemeParams params |
An instance of |
public @NonNull CustomTabsIntent.BuildersetDefaultShareMenuItemEnabled(boolean enabled)
Set whether a default share item is added to the menu.
| Parameters | |
|---|---|
boolean enabled |
Whether default share item is added. |
setDownloadButtonEnabled
public @NonNull CustomTabsIntent.Builder setDownloadButtonEnabled(boolean enabled)
Enables or disables the download button in the overflow menu. The button is enabled by default.
| Parameters | |
|---|---|
boolean enabled |
Whether the download button is enabled. |
| See also | |
|---|---|
EXTRA_DISABLE_DOWNLOAD_BUTTON |
setEphemeralBrowsingEnabled
public @NonNull CustomTabsIntent.Builder setEphemeralBrowsingEnabled(boolean enabled)
Sets whether to enable ephemeral browsing within the Custom Tab. If ephemeral browsing is enabled, and the browser supports it, the Custom Tab does not share cookies or other data with the browser.
| Parameters | |
|---|---|
boolean enabled |
Whether ephemeral browsing is enabled. |
| See also | |
|---|---|
EXTRA_ENABLE_EPHEMERAL_BROWSING |
setExitAnimations
public @NonNull CustomTabsIntent.Builder setExitAnimations(
@NonNull Context context,
@AnimRes int enterResId,
@AnimRes int exitResId
)
Sets the exit animations.
setInitialActivityHeightPx
public @NonNull CustomTabsIntent.Builder setInitialActivityHeightPx(@Dimension(unit = 1) int initialHeightPx)
Sets the Custom Tab Activity's initial height in pixels with default resize behavior. The Custom Tab will behave as a bottom sheet if the screen's width is smaller than the breakpoint value set by setActivitySideSheetBreakpointDp.
| See also | |
|---|---|
setInitialActivityHeightPx |
setInitialActivityHeightPx
public @NonNull CustomTabsIntent.Builder setInitialActivityHeightPx(
@Dimension(unit = 1) int initialHeightPx,
int activityHeightResizeBehavior
)
Sets the Custom Tab Activity's initial height in pixels and the desired resize behavior. The Custom Tab will behave as a bottom sheet if the screen's width is smaller than the breakpoint value set by setActivitySideSheetBreakpointDp.
| Parameters | |
|---|---|
@Dimension(unit = 1) int initialHeightPx |
The Custom Tab Activity's initial height in pixels. |
int activityHeightResizeBehavior |
Desired height behavior. |
setInitialActivityWidthPx
public @NonNull CustomTabsIntent.Builder setInitialActivityWidthPx(@Dimension(unit = 1) int initialWidthPx)
Sets the Custom Tab Activity's initial width in pixels. The Custom Tab will behave as a side sheet if the screen's width is bigger than the breakpoint value set by setActivitySideSheetBreakpointDp and the screen is big enough, see doc for EXTRA_INITIAL_ACTIVITY_WIDTH_PX.
| Parameters | |
|---|---|
@Dimension(unit = 1) int initialWidthPx |
The Custom Tab Activity's initial width in pixels. |
| See also | |
|---|---|
EXTRA_INITIAL_ACTIVITY_WIDTH_PX |
setInitialNavigationAllowedToLeaveBrowser
@ExperimentalInitialNavigationCanLeaveBrowser
public @NonNull CustomTabsIntent.Builder setInitialNavigationAllowedToLeaveBrowser(boolean enabled)
Allows the Custom Tab to forward the initial URL sent to the Custom Tab to the default handling app for that URL instead of loading it (including following any redirects) in the Custom Tab.
Note: This is not the default behavior. The default for this is to be set to false.
| Parameters | |
|---|---|
boolean enabled |
Whether the initial URL sent to the custom tab should be sent to the default handling app for that URL. |
setInstantAppsEnabled
public @NonNull CustomTabsIntent.Builder setInstantAppsEnabled(boolean enabled)
Sets whether Instant Apps is enabled for this Custom Tab.
| Parameters | |
|---|---|
boolean enabled |
Whether Instant Apps should be enabled. |
public @NonNull CustomTabsIntent.BuildersetNavigationBarColor(@ColorInt int color)
Sets the navigation bar color. Has no effect on API versions below L. To ensure good contrast between navigation bar icons and the background, Custom Tab implementations may use SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR on Android O and above, and darken the provided color on Android L-N. Can be overridden for particular color schemes, see setColorSchemeParams.
| Parameters | |
|---|---|
@ColorInt int color |
The color for the navigation bar. |
public @NonNull CustomTabsIntent.BuildersetNavigationBarDividerColor(@ColorInt int color)
Sets the navigation bar divider color. Has no effect on API versions below P. Can be overridden for particular color schemes, see setColorSchemeParams.
| Parameters | |
|---|---|
@ColorInt int color |
The color for the navigation bar divider. |
setNetwork
public @NonNull CustomTabsIntent.Builder setNetwork(@NonNull Network network)
Sets the target network Network to bind when launching a custom tab. This API allows the caller to specify the target network to bind when launching a URL via Custom Tabs, e.g. may want to open a custom tab over a Wi-Fi network, while the default network is a cellular connection. All URLRequests created in the future via this tab will be bound to Network. If the browser does not support this feature it will be ignored and a Custom Tab will be opened using the default network. Check the support by calling isSetNetworkSupported.
| See also | |
|---|---|
EXTRA_NETWORK |
setOpenInBrowserButtonState
@ExperimentalOpenInBrowser
public @NonNull CustomTabsIntent.Builder setOpenInBrowserButtonState(int openInBrowserState)
Sets the state for the Open in Browser button in the toolbar for this Custom Tab.
| Parameters | |
|---|---|
int openInBrowserState |
Desired Open in Browser state. |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
when an invalid option is provided. |
setPendingSession
public @NonNull CustomTabsIntent.Builder setPendingSession(@NonNull CustomTabsSession.PendingSession session)
Associates the Intent with the given CustomTabsSession.PendingSession. Overrides the effect of setSession.
public @NonNull CustomTabsIntent.BuildersetSecondaryToolbarColor(@ColorInt int color)
Sets the color of the secondary toolbar. Can be overridden for particular color schemes, see setColorSchemeParams.
| Parameters | |
|---|---|
@ColorInt int color |
The color for the secondary toolbar. |
setSecondaryToolbarSwipeUpGesture
public @NonNull CustomTabsIntent.Builder setSecondaryToolbarSwipeUpGesture(@Nullable PendingIntent pendingIntent)
Sets the PendingIntent to be sent when the user swipes up from the secondary (bottom) toolbar.
| Parameters | |
|---|---|
@Nullable PendingIntent pendingIntent |
The |
setSecondaryToolbarViews
public @NonNull CustomTabsIntent.Builder setSecondaryToolbarViews(
@NonNull RemoteViews remoteViews,
@Nullable int[] clickableIDs,
@Nullable PendingIntent pendingIntent
)
Sets the remote views displayed in the secondary toolbar in a custom tab.
| Parameters | |
|---|---|
@NonNull RemoteViews remoteViews |
The |
@Nullable int[] clickableIDs |
The IDs of clickable views. The onClick event of these views will be handled by custom tabs. |
@Nullable PendingIntent pendingIntent |
The |
setSendToExternalDefaultHandlerEnabled
public @NonNull CustomTabsIntent.Builder setSendToExternalDefaultHandlerEnabled(boolean enabled)
Enables sending any redirects off of the initial URL sent to the Custom Tab to default handling apps. Unless #EXTRA_INITIAL_NAVIGATION_CAN_LEAVE_BROWSER is also set, the initial URL will still always load in the Custom Tab.
| Parameters | |
|---|---|
boolean enabled |
Whether to send urls to external handler. |
setSession
public @NonNull CustomTabsIntent.Builder setSession(@NonNull CustomTabsSession session)
Associates the Intent with the given CustomTabsSession. Guarantees that the Intent will be sent to the same component as the one the session is associated with.
setShareIdentityEnabled
public @NonNull CustomTabsIntent.Builder setShareIdentityEnabled(boolean enabled)
Allow Custom Tabs to obtain the caller's identity i.e. package name.
| Parameters | |
|---|---|
boolean enabled |
Whether the identity sharing is enabled. |
setShareState
public @NonNull CustomTabsIntent.Builder setShareState(int shareState)
Sets the share state that should be applied to the custom tab.
| Parameters | |
|---|---|
int shareState |
Desired share state. |
setShowTitle
public @NonNull CustomTabsIntent.Builder setShowTitle(boolean showTitle)
Sets whether the title should be shown in the custom tab.
| Parameters | |
|---|---|
boolean showTitle |
Whether the title should be shown. |
setStartAnimations
public @NonNull CustomTabsIntent.Builder setStartAnimations(
@NonNull Context context,
@AnimRes int enterResId,
@AnimRes int exitResId
)
Sets the start animations.
public @NonNull CustomTabsIntent.BuildersetToolbarColor(@ColorInt int color)
Sets the toolbar color. On Android L and above, this color is also applied to the status bar. To ensure good contrast between status bar icons and the background, Custom Tab implementations may use SYSTEM_UI_FLAG_LIGHT_STATUS_BAR on Android M and above, and use a darkened color for the status bar on Android L. Can be overridden for particular color schemes, see setColorSchemeParams.
setToolbarCornerRadiusDp
public @NonNull CustomTabsIntent.Builder setToolbarCornerRadiusDp(@Dimension(unit = 0) int cornerRadiusDp)
Sets the toolbar's top corner radii in dp.
| Parameters | |
|---|---|
@Dimension(unit = 0) int cornerRadiusDp |
The toolbar's top corner radii in dp. |
| See also | |
|---|---|
EXTRA_TOOLBAR_CORNER_RADIUS_DP |
setTranslateLocale
public @NonNull CustomTabsIntent.Builder setTranslateLocale(@NonNull Locale locale)
Specifies the target locale the Translate UI should be triggered with.
| See also | |
|---|---|
EXTRA_TRANSLATE_LANGUAGE_TAG |
setUrlBarHidingEnabled
public @NonNull CustomTabsIntent.Builder setUrlBarHidingEnabled(boolean enabled)
Set whether the url bar should hide as the user scrolls down on the page.
| Parameters | |
|---|---|
boolean enabled |
Whether url bar hiding is enabled. |