![Sebastian Benz](https://web.dev/images/authors/sebastianbenz.jpg) Sebastian Benz [GitHub](https://github.com/sebastianbenz) [Mastodon](https://mastodon.cloud/@sebabenz) [Bluesky](https://bsky.app/profile/sebabenz.bsky.social)

<br />

One advantage of Custom Tabs is that they can be seamlessly integrated into your app. In this part of the Custom Tabs guide, you will learn how to change the appearance and behavior of a Custom Tab to match your app.

## Set the color of the toolbar

![Custom Tab with a custom light color scheme](https://developer.chrome.com/static/docs/android/custom-tabs/guide-ui-customization/image/custom-tab-a-custom-ligh-a25471aaa0cb9.png) Light mode ![Custom Tab with a custom dark color scheme](https://developer.chrome.com/static/docs/android/custom-tabs/guide-ui-customization/image/custom-tab-a-custom-dark-4673c50a2cf6c.png) Dark mode

First, customizing the Custom Tab's address bar to be consistent with your app's theme. The snippet below changes the default toolbar color by calling [`setDefaultColorSchemeParams()`](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder?cmdf=setDefaultColorSchemeParams+custom+tabs#setDefaultColorSchemeParams(androidx.browser.customtabs.CustomTabColorSchemeParams)). If your app also supports a dark color scheme, set it via [`.setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_DARK, ...)`](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setColorSchemeParams(int,androidx.browser.customtabs.CustomTabColorSchemeParams)).

    // get the current toolbar background color (this might work differently in your app)
    @ColorInt int colorPrimaryLight = ContextCompat.getColor(MainActivity.this, R.color.md_theme_light_primary);
    @ColorInt int colorPrimaryDark = ContextCompat.getColor(MainActivity.this, R.color.md_theme_dark_primary);

    CustomTabsIntent intent = new CustomTabsIntent.Builder()
            // set the default color scheme
            .setDefaultColorSchemeParams(new CustomTabColorSchemeParams.Builder()
                    .setToolbarColor(colorPrimaryLight)
                    .build())
            // set the alternative dark color scheme
            .setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_DARK, new CustomTabColorSchemeParams.Builder()
                    .setToolbarColor(colorPrimaryDark)
                    .build())
            .build();

The toolbar now has custom background and foreground colors.

> [!IMPORTANT]
> **Key point:** The Custom Tab protocol [does not support changing the color of the status bar](https://issuetracker.google.com/issues/37083468).

## Configure custom enter and exit animation

Next, you can make launching (and leaving) a Custom Tab experience in your app more seamless, by defining custom start and exit animations using `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setStartAnimations(android.content.Context,int,int)` and `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setExitAnimations(android.content.Context,int,int)`:

    CustomTabsIntent intent = new CustomTabsIntent.Builder()
    ...
    .setStartAnimations(MainActivity.this, R.anim.slide_in_right, R.anim.slide_out_left)
    .setExitAnimations(MainActivity.this, android.R.anim.slide_in_left, android.R.anim.slide_out_right)
    .build();

## Further customizations: title, autohide AppBar, and custom close icon

There are a few more things you can do to adjust the UI of a Custom Tab to your needs.

- Hide the URL bar on scroll to give the user more space to explore web content using `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setUrlBarHidingEnabled(boolean)(true)`.
- Show the document title instead of the URL via `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setShowTitle(boolean)(true)`.
- Customize the close button to match the user flow in your app, for example, by showing a back arrow instead of the default `X` icon): `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setCloseButtonIcon(android.graphics.Bitmap)(myCustomCloseIcon)`.

These are all optional, but they can improve the Custom Tab experience in your app.

    Bitmap myCustomCloseIcon = getDrawable(R.drawable.ic_baseline_arrow_back_24));
    CustomTabsIntent intent = new CustomTabsIntent.Builder()
      ...
      .setUrlBarHidingEnabled(true)
      .setShowTitle(true)
      .setCloseButtonIcon(toBitmap(myCustomCloseIcon))
      .build();

## Setting a custom referrer

You can set your app as the referrer when launching your Custom Tab. This way you can let websites know where their traffic is coming from.

    CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build()
    customTabsIntent.intent.putExtra(Intent.EXTRA_REFERRER,
           Uri.parse("android-app://" + context.getPackageName()));

Next up: [learn how to add custom action to your Custom Tab](https://developer.chrome.com/docs/android/custom-tabs/guide-interactivity).