App bars are placed at the top of the screen to help people navigate through a product. There are four variants of app bars.
Note: The top app bar component is renamed to app bar in the design language.

For implementation purposes, the search and small app bars can be grouped into regular top app bars, while the medium flexible and large flexible app bars can be grouped into collapsing top app bars.
An app bar can transform into a contextual action bar, remaining active until an action is taken or it is dismissed. For more information, see contextual action bar.
Note: Images use various dynamic color schemes.
There are two variants that are being deprecated and are no longer recommended:


More details on anatomy items in the component guidelines.
Before you can use Material3Expressive component styles, follow the
Material3Expressive themes setup instructions.
The new search app bar supports icons inside and outside the search bar, and centered text. It opens the search view component when selected.
The new medium flexible and large flexible app bars come with significant improvements, and should replace medium and large app bars, which are being deprecated. The small app bar is updated with the same flexible improvements. More on M3 Expressive
Types and naming:
| Element | Attribute | Related method(s) | Default value |
|---|---|---|---|
| Color | android:background |
setBackgroundgetBackground |
?attr/colorSurface |
MaterialToolbar elevation |
android:elevation |
setElevationgetElevation |
4dp |
AppBarLayout elevation |
android:stateListAnimator |
setStateListAnimatorgetStateListAnimator |
0dp to 4dp (see all states) |
| Element | Attribute | Related method(s) | Default value |
|---|---|---|---|
MaterialToolbar icon |
app:navigationIcon |
setNavigationIcongetNavigationIcon |
null |
MaterialToolbar icon color |
app:navigationIconTint |
setNavigationIconTint |
?attr/colorOnSurface |
| Element | Attribute | Related method(s) | Default value |
|---|---|---|---|
MaterialToolbar title text |
app:title |
setTitlegetTitle |
null |
MaterialToolbar subtitle text |
app:subtitle |
setSubtitlegetSubtitle |
null |
MaterialToolbar title color |
app:titleTextColor |
setTitleTextColor |
?attr/colorOnSurface |
MaterialToolbar subtitle color |
app:subtitleTextColor |
setSubtitleTextColor |
?attr/colorOnSurfaceVariant |
MaterialToolbar title typography |
app:titleTextAppearance |
setTitleTextAppearance |
?attr/textAppearanceTitleLarge |
MaterialToolbar subtitle typography |
app:subtitleTextAppearance |
setSubtitleTextAppearance |
?attr/textAppearanceTitleMedium |
MaterialToolbar title centering |
app:titleCentered |
setTitleCentered |
false |
MaterialToolbar subtitle centering |
app:subtitleCentered |
setSubtitleCentered |
false |
CollapsingToolbarLayout collapsed title typography |
app:collapsedTitleTextAppearance |
setCollapsedTitleTextAppearance |
?attr/textAppearanceTitleLarge |
CollapsingToolbarLayout expanded title typography |
app:expandedTitleTextAppearance |
setExpandedTitleTextAppearance |
?attr/textAppearanceHeadlineSmall for Medium</br>?attr/textAppearanceHeadlineMedium for Large |
CollapsingToolbarLayout collapsed title color |
android:textColor (in app:collapsedTitleTextAppearance) or app:collapsedTitleTextColor |
setCollapsedTitleTextColor |
?attr/colorOnSurface |
CollapsingToolbarLayout expanded title color |
android:textColor (in app:expandedTitleTextAppearance) or app:expandedTitleTextColor |
setExpandedTitleTextColor |
?attr/colorOnSurface |
CollapsingToolbarLayout collapsed subtitle typography |
app:collapsedSubtitleTextAppearance |
setCollapsedSubtitleTextAppearance |
?attr/textAppearanceTitleMedium |
CollapsingToolbarLayout expanded subtitle typography |
app:expandedSubtitleTextAppearance |
setExpandedSubtitleTextAppearance |
?attr/textAppearanceTitleLarge for Medium</br>?attr/textAppearanceHeadlineSmall for Large |
CollapsingToolbarLayout collapsed subtitle color |
android:textColor (in app:collapsedSubtitleTextAppearance) or app:collapsedSubtitleTextColor |
setCollapsedSubtitleTextColor |
?attr/colorOnSurface |
CollapsingToolbarLayout expanded subtitle color |
android:textColor (in app:expandedSubtitleTextAppearance) or app:expandedSubtitleTextColor |
setExpandedSubtitleTextColor |
?attr/colorOnSurface |
CollapsingToolbarLayout expanded title margins |
app:expandedTitleMargin* |
setExpandedTitleMargin* |
16dp |
CollapsingToolbarLayout padding between expanded title and subtitle |
app:expandedTitlePadding |
setExpandedTitlePadding |
0dp |
CollapsingToolbarLayout title max lines |
app:maxLines |
setMaxLinesgetMaxLines |
1 |
CollapsingToolbarLayout title ellipsize |
app:titleTextEllipsize |
setTitleEllipsizegetTitleEllipsize |
end |
CollapsingToolbarLayout collapsed title gravity |
app:collapsedTitleGravity |
setCollapsedTitleGravitygetCollapsedTitleGravity |
start\|center_vertical |
CollapsingToolbarLayout collapsed title gravity mode |
app:collapsedTitleGravityMode |
– | availableSpace |
CollapsingToolbarLayout expanded title gravity |
app:expandedTitleGravity |
setExpandedTitleGravitygetExpandedTitleGravity |
start\|bottom |
| Element | Attribute | Related method(s) | Default value |
|---|---|---|---|
MaterialToolbar menu |
app:menu |
inflateMenugetMenu |
null |
MaterialToolbar icon color |
N/A | N/A | ?attr/colorOnSurfaceVariant |
| Element | Attribute | Related method(s) | Default value |
|---|---|---|---|
MaterialToolbar icon |
android:src and app:srcCompat in actionOverflowButtonStyle (in app theme) |
setOverflowIcongetOverflowIcon |
@drawable/abc_ic_menu_overflow_material (before API 23) or @drawable/ic_menu_moreoverflow_material (after API 23) |
MaterialToolbar overflow theme |
app:popupTheme |
setPopupThemegetPopupTheme |
@style/ThemeOverlay.Material3.* |
MaterialToolbar overflow item typography |
textAppearanceSmallPopupMenu and textAppearanceLargePopupMenu in app:popupTheme or app theme |
N/A | ?attr/textAppearanceBodyLarge |
| Element | Attribute | Related method(s) | Default value |
|---|---|---|---|
MaterialToolbar or CollapsingToolbarLayout scroll flags |
app:layout_scrollFlags |
setScrollFlagsgetScrollFlags(on AppBarLayout.LayoutParams) |
noScroll |
MaterialToolbar collapse mode |
app:collapseMode |
setCollapseModegetCollapseMode(on CollapsingToolbar) |
none |
CollapsingToolbarLayout content scrim color |
app:contentScrim |
setContentScrimsetContentScrimColorsetContentScrimResourcegetContentScrim |
null |
CollapsingToolbarLayout status bar scrim color |
app:statusBarScrim |
setStatusBarScrimsetStatusBarScrimColorsetStatusBarScrimResourcegetStatusBarScrim |
@empty |
CollapsingToolbarLayout scrim animation duration |
app:scrimAnimationDuration |
setScrimAnimationDurationgetScrimAnimationDuration |
600 |
CollapsingToolbarLayout collapsing animation interpolator |
app:titlePositionInterpolator |
setTitlePositionInterpolator |
@null |
AppBarLayout lift on scroll |
app:liftOnScroll |
setLiftOnScrollisLiftOnScroll |
true |
AppBarLayout lift on scroll color |
app:liftOnScrollColor |
N/A | ?attr/colorSurfaceContainer |
AppBarLayout lift on scroll target view |
app:liftOnScrollTargetViewId |
setLiftOnScrollTargetViewIdgetLiftOnScrollTargetViewId |
@null |
AppBarLayout scroll effect |
app:layout_scrollEffect |
setScrollEffectgetScrollEffect |
none |
AppBarLayout stylesWidget.Material3.AppBarLayout | ?attr/appBarLayoutStyle |MaterialToolbar styles| Element | Style | Theme attribute |
|---|---|---|
| Default style | Widget.Material3.Toolbar |
?attr/toolbarStyle |
| Surface background color style | Widget.Material3.Toolbar.Surface |
?attr/toolbarSurfaceStyle |
| On Surface color style | Widget.Material3.Toolbar.OnSurface |
N/A |
CollapsingToolbarLayout styles| Element | Style | Theme attribute |
|---|---|---|
| Default style | Widget.Material3.CollapsingToolbar |
?attr/collapsingToolbarLayoutStyle |
| Medium style | Widget.Material3.CollapsingToolbar.Medium |
?attr/collapsingToolbarLayoutMediumStyle |
| Large style | Widget.Material3.CollapsingToolbar.Large |
?attr/collapsingToolbarLayoutLargeStyle |
For the full list, see styles and attrs.
Search app bars have a search field instead of heading text
In the layout:
```xml
<androidx.coordinatorlayout.widget.CoordinatorLayout
...
android:layout_width="match_parent"
android:layout_height="match_parent">
The
[medium flexible top app bar](https://m3.material.io/components/app-bars/specs#51ac0fae-61c2-4abc-b8f9-1167bf54e875)
introduced in expressive updates includes flexible heights, multi-line support,
and can contain a wider variety of elements. These features are already
supported/configurable within the existing Medium variant. Therefore, the name
of the existing `medium` variant will be reused in the `Material3Expressive`
theme.
**If you are using a `Material3Expressive` theme:**
The existing `?attr/collapsingToolbarLayoutMediumStyle` attribute has been
updated to the new flexible behavior. You do not need to change your XML layouts
to get the new functionality.
**If you are not using a `Material3Expressive` theme:**
You should migrate to one of the expressive themes to use the new flexible app
bar styles.
To properly draw the subtitle in expanded mode. Please use the following:
```xml
The
[large flexible top app bar](https://m3.material.io/components/app-bars/specs#51ac0fae-61c2-4abc-b8f9-1167bf54e875)
introduced in expressive updates includes flexible heights, multi-line support,
and can contain a wider variety of elements. These features are already
supported/configurable within the existing Large variant. Therefore, the name of
the existing `large` variant will be reused in the `Material3Expressive` theme.
**If you are using a `Material3Expressive` theme:**
The existing `?attr/collapsingToolbarLayoutLargeStyle` attribute has been
updated to the new flexible behavior. You do not need to change your XML layouts
to get the new functionality.
**If you are not using a `Material3Expressive` theme:**
You should migrate to one of the expressive themes to use the new flexible app
bar styles.
To properly draw the subtitle in expanded mode. Please use the following:
```xml
Before you can use Material top app bars, you need to add a dependency to the Material components for Android library. For more information, go to the Getting started page.
In the layout:
```xml
<androidx.coordinatorlayout.widget.CoordinatorLayout
...
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
...
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
A common configuration for modern top app bars, as seen above, is to have a
seamless color shared with the status bar. The best way to achieve this is to
follow the
[edge-to-edge guidance](https://developer.android.com/training/gestures/edge-to-edge),
which will result in a transparent status bar that lets the background color of
the top app bar show through.
Make sure to set `android:fitsSystemWindows="true"` on your `AppBarLayout` (or
`MaterialToolbar` if not using `AppBarLayout`), so that an extra inset is added
to avoid overlap with the status bar.
If your `AppBarLayout` scrolls and content is visible under the status bar, you
can set the `AppBarLayout`'s `statusBarForeground` to a `MaterialShapeDrawable`
to let `AppBarLayout` automatically match the status bar color to its own
background.
In code:
```kt
appBarLayout.statusBarForeground =
MaterialShapeDrawable.createWithElevationOverlay(context)
```
Or if using tonal surface colors instead of elevation overlays, you can simply
set the `statusBarForeground` to `colorSurface` to let `AppBarLayout`
automatically match the status bar color to its own background:
```kt
appBarLayout.setStatusBarForegroundColor(
MaterialColors.getColor(appBarLayout, R.attr.colorSurface))
```
App bars support the customization of color, typography, and shape.
API and source code:
CoordinatorLayout
AppBarLayout
MaterialToolbar
CollapsingToolbarLayout
A regular top app bar with Material theming:

Use theme attributes in res/values/styles.xml, which applies to all top app
bars and affects other components:
<style name="Theme.App" parent="Theme.Material3.*.NoActionBar">
...
<item name="colorSurface">@color/shrine_pink_100</item>
<item name="colorOnSurface">@color/shrine_pink_900</item>
<item name="android:statusBarColor">?attr/colorPrimary</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="textAppearanceTitleLarge">@style/TextAppearance.App.TitleLarge</item>
<item name="textAppearanceTitleMedium">@style/TextAppearance.App.TitleMedium</item>
</style>
<style name="TextAppearance.App.TitleLarge" parent="TextAppearance.Material3.TitleLarge">
<item name="fontFamily">@font/rubik</item>
<item name="android:fontFamily">@font/rubik</item>
</style>
<style name="TextAppearance.App.TitleMedium" parent="TextAppearance.Material3.TitleMedium">
<item name="fontFamily">@font/rubik</item>
<item name="android:fontFamily">@font/rubik</item>
</style>
Use default style theme attributes, styles and theme overlays, which applies to all top app bars but does not affect other components:
<style name="Theme.App" parent="Theme.Material3.*.NoActionBar">
...
<item name="toolbarStyle">@style/Widget.App.Toolbar</item>
</style>
<style name="Widget.App.Toolbar" parent="Widget.Material3.Toolbar">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Toolbar</item>
<item name="titleTextAppearance">@style/TextAppearance.App.TitleLarge</item>
<item name="subtitleTextAppearance">@style/TextAppearance.App.TitleMedium</item>
</style>
<style name="ThemeOverlay.App.Toolbar" parent="">
<item name="colorSurface">@color/shrine_pink_100</item>
<item name="colorOnSurface">@color/shrine_pink_900</item>
</style>
Use the style in the layout, which affects only this top app bar:
<com.google.android.material.appbar.MaterialToolbar
...
app:title="@string/flow_shirt_blouse"
app:menu="@menu/top_app_bar_shrine"
app:navigationIcon="@drawable/ic_close_24dp"
style="@style/Widget.App.Toolbar"
/>
Contextual action bars provide actions for selected items.
There are two deprecated app bars that are no longer recommended:

The larger collapsing top app bars can be used for longer titles, to house imagery, or to provide a stronger presence to the top app bar.
In the layout:
```xml
<androidx.coordinatorlayout.widget.CoordinatorLayout
...>
<com.google.android.material.appbar.AppBarLayout
...
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
In the layout:
```xml
<androidx.coordinatorlayout.widget.CoordinatorLayout
...>
<com.google.android.material.appbar.AppBarLayout
...
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">