11<!-- docs:
2- title: "Docked Toolbar "
2+ title: "Docked toolbar "
33layout: detail
44section: components
55excerpt: "Docked toolbars show actions related to the current page"
66iconId: docked_toolbar
77path: /catalog/docked-toolbar/
88-->
99
10- # Docked Toolbar
10+ # Docked toolbar
1111
12- Docked Toolbar provides a way to show actions related to the current page.
13- Docked Toolbar is one variant of Toolbars. Toolbars can also be undocked, ie. [ Floating Toolbars] ( FloatingToolbar.md ) .
12+ Docked toolbar provides a way to show actions related to the current page.
1413
1514![ Docked toolbar] ( assets/dockedtoolbar/docked_toolbar.png )
1615
17- ** Contents **
16+ ** Note: ** Images use various dynamic color schemes.
1817
19- * [ Design and API Documentation] ( #design-and-api-documentation )
20- * [ Using Docked Toolbar] ( #using-docked-toolbar )
21- * [ Theming] ( #theming-a-docked-toolbar )
18+ ## Design & API documentation
2219
23- ## Design and API Documentation
20+ * [ Material 3 (M3) spec] ( https://m3.material.io/components/toolbars/overview )
21+ * API reference in progress
2422
25- * Google Material3 Spec in progress
26- * API Reference in progress
23+ ## Anatomy
2724
28- ## Using Docked Toolbar
25+ < img src = " assets/dockedtoolbar/docked_toolbar_anatomy.png " alt = " Docked toolbar anatomy diagram " height = " 350 " >
2926
30- Before you can use the Docked Toolbar, you need to add a dependency to
31- the Material Components for Android library. For more information, go to the
27+ 1 . Container
28+ 2 . Elements
29+
30+ More details on anatomy items in the
31+ [ component guidelines] ( https://m3.material.io/components/toolbars/guidelines#d6b7bcb1-295d-41e6-a051-37f12e1c96ab ) .
32+
33+ ## M3 Expressive update
34+
35+ Before you can use ` Material3Expressive ` component styles, follow the
36+ [ ` Material3Expressive themes ` setup instructions] ( https://github.com/material-components/material-components-android/tree/master/docs/getting-started.md#material3expressive-themes ) .
37+
38+ <img src =" assets/dockedtoolbar/dockedtoolbar_expressive.png " alt =" Docked toolbar " height =" 350 " >
39+ Docked with embedded primary action instead of FAB
40+
41+ The ** bottom app bar** is being deprecated and should be replaced with the
42+ ** docked toolbar** , which functions similarly, but is shorter and has more
43+ flexibility.
44+ [ More on M3 Expressive] ( https://m3.material.io/blog/building-with-m3-expressive )
45+
46+ ** Types and naming**
47+
48+ * Added ** docked toolbar** to replace ** bottom app bar**
49+
50+ * Size: Shorter height
51+ * Color: Standard or vibrant
52+ * Flexibility: More layout and element options
53+
54+ * ** Bottom app bar** is still available, but not recommended
55+
56+ ## Key properties
57+
58+ ### Container attributes
59+
60+ Element | Attribute | Related methods | Default value
61+ ------------------------ | ------------------------------------- | --------------- | -------------
62+ ** Color** | ` app:backgroundTint ` | N/A | ` ?attr/colorSurfaceContainer `
63+ ** Shape** | ` app:shapeAppearance ` | N/A | ` 0% rounded `
64+ ** Top inset padding** | ` app:paddingTopSystemWindowInsets ` | N/A | ` unset `
65+ ** Bottom inset padding** | ` app:paddingBottomSystemWindowInsets ` | N/A | ` unset `
66+
67+ ** Note:** ` DockedToolbarLayout ` automatically adds top or bottom inset based on
68+ its gravity inside a ` CoordinatorLayout ` , if ` app:paddingTopSystemWindowInsets `
69+ or ` app:paddingBottomSystemWindowInsets ` is not set. If not using a docked
70+ toolbar inside a ` CoordinatorLayout ` , set these attributes explicitly to add
71+ inset padding.
72+
73+ ### Styles
74+
75+ Element | Style | Theme attribute
76+ ----------------- | ---------------------------------------- | ---------------
77+ ** Default style** | ` Widget.Material3.DockedToolbar ` | ` ?attr/dockedToolbarStyle `
78+ ** Vibrant style** | ` Widget.Material3.DockedToolbar.Vibrant ` | ` ?attr/dockedToolbarVibrantStyle `
79+
80+ The default style is the standard style.
81+
82+ Docked toolbar also recommends a special style for specific components for when
83+ they are inside of a docked toolbar. Currently, the docked toolbar styles also
84+ include a theme overlay for ` ?attr/materialButtonStyle ` ,
85+ ` ?attr/materialIconButtonStyle ` , and ` ?attr/borderlessButtonStyle ` to style
86+ buttons inside of a docked toolbar.
87+
88+ For the full list, see
89+ [ styles] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/dockedtoolbar/res/values/styles.xml )
90+ and
91+ [ docked toolbar attributes] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/dockedtoolbar/res/values/attrs.xml )
92+
93+ ## Code implementation
94+
95+ Before you can use the docked toolbar, you need to add a dependency to the
96+ Material components for Android library. For more information, go to the
3297[ Getting started] ( https://github.com/material-components/material-components-android/tree/master/docs/getting-started.md )
3398page.
3499
100+ ### Adding docked toolbar
101+
35102Here's what a typical layout would look like:
36103
37104``` xml
@@ -126,17 +193,17 @@ Here's what a typical layout would look like:
126193</androidx .coordinatorlayout.widget.CoordinatorLayout>
127194```
128195
129- A Docked Toolbar is a ` FrameLayout ` that provides additional styling.
130- You may add children to it as you would to a ` FrameLayout ` . It's recommended to
131- have its children wrapped by an ` OverflowLinearLayout ` that will handle
132- automatically adding items to an overflow menu when there's not enough screen
133- space to show all the items.
196+ A docked toolbar is a ` FrameLayout ` that provides additional styling. You may
197+ add children to it as you would to a ` FrameLayout ` . It's recommended to have its
198+ children wrapped by an ` OverflowLinearLayout ` that will handle automatically
199+ adding items to an overflow menu when there's not enough screen space to show
200+ all the items.
134201
135202When using ` OverflowLinearLayout ` , you should also set ` app:layout_overflowText `
136203on each child as that will be the text of the menu item that corresponds to the
137204hidden child. Optionally, you can also set ` app:layout_overflowIcon ` . See
138205[ OverflowLinearLayout] ( https://github.com/material-components/material-components-android/tree/master/docs/components/OverflowLinearLayout.md )
139- for more info .
206+ for more information .
140207
141208Note: if the child view that is clickable is not a direct child of
142209` OverflowLinearLayout ` , such as the case of the example above, make sure to
@@ -160,7 +227,7 @@ through the `app:layout_behavior` attribute:
160227</com .google.android.material.dockedtoolbar.DockedToolbarLayout>
161228```
162229
163- [ Top App Bars ] ( TopAppBar.md ) and [ Bottom App Bars ] ( BottomAppBar.md ) are also
230+ [ Top app bars ] ( TopAppBar.md ) and [ Bottom app bars ] ( BottomAppBar.md ) are also
164231implementations of a docked toolbar which offer more in terms of functionality,
165232but are less flexible than the ` DockedToolbarLayout ` implementation.
166233
@@ -169,16 +236,16 @@ API and source code:
169236* ` DockedToolbar `
170237 * [ Class source] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/dockedtoolbar/DockedToolbarLayout.java )
171238
172- ### Making Docked Toolbar accessible
239+ ### Making docked toolbar accessible
173240
174- You should set a ` contentDescription ` on all the actions in the Docked Toolbar
241+ You should set a ` contentDescription ` on all the actions in the docked toolbar
175242so that screen readers like TalkBack can properly announce what each action
176243represents.
177244
178- You can also control the ordering of the Talkback focus through the
245+ You can also control the ordering of the TalkBack focus through the
179246` accessibilityTraversalBefore ` and ` accessibilityTraversalAfter ` flags.
180247
181- For example, if you want the Docked Toolbar to gain Talkback focus first, you
248+ For example, if you want the docked toolbar to gain TalkBack focus first, you
182249can set these accessibility flags like below:
183250
184251``` xml
@@ -208,17 +275,17 @@ can set these accessibility flags like below:
208275 </com .google.android.material.dockedtoolbar.DockedToolbarLayout>
209276```
210277
211- #### Talkback
278+ #### TalkBack
212279
213280Docked toolbars can optionally use the ` CoordinatorLayout.Behavior `
214281` HideViewOnScrollBehavior ` to hide the docked toolbar on scroll. This behavior
215- is disabled when Talkback is enabled disabled due to screen readers not being
282+ is disabled when TalkBack is enabled disabled due to screen readers not being
216283able to see it if the docked toolbar is hidden when scrolled.
217284
218- If using a docked toolbar in a layout that obscures any content when
219- hide on scroll is disabled, make sure to add the appropriate padding to the
220- content. For example, if the docked toolbar is on the bottom and it is
221- obscuring the content, bottom padding should be added to the content.
285+ If using a docked toolbar in a layout that obscures any content when hide on
286+ scroll is disabled, make sure to add the appropriate padding to the content. For
287+ example, if the docked toolbar is on the bottom and it is obscuring the content,
288+ bottom padding should be added to the content.
222289
223290See below for an example:
224291
@@ -237,64 +304,19 @@ if (am != null && am.isTouchExplorationEnabled) {
237304}
238305```
239306
240- ### Anatomy and key properties
241-
242- The following is an anatomy diagram for the docked toolbar:
243-
244- ![ Docked toolbar anatomy diagram] ( assets/dockedtoolbar/docked_toolbar_anatomy.png )
245-
246- 1 . Container
247- 2 . Content
248-
249- #### Container attributes
250-
251- ** Element** | ** Attribute** | ** Related methods** | ** Default value**
252- ----------------------- | ------------------------------------ | ------------------- | -----------------
253- ** Color** | ` app:backgroundTint ` | N/A | ` ?attr/colorSurfaceContainer `
254- ** Shape** | ` app:shapeAppearance ` | N/A | ` 0% rounded `
255- ** Top inset padding** | ` app:paddingTopSystemWindowInsets ` | N/A | ` unset `
256- ** Bottom inset padding** | ` app:paddingBottomSystemWindowInsets ` | N/A | ` unset `
257-
258- ** Note:** ` DockedToolbarLayout ` automatically adds top or bottom inset based on
259- its gravity inside a ` CoordinatorLayout ` , if ` app:paddingTopSystemWindowInsets `
260- or ` app:paddingBottomSystemWindowInsets ` is not set. If not using a Docked
261- Toolbar inside a ` CoordinatorLayout ` , set these attributes explicitly to add
262- inset padding.
263-
264- #### Styles
265-
266- ** Element** | ** Style**
267- ----------------- | ----------------------------------------
268- ** Default style** | ` Widget.Material3.DockedToolbar `
269- ** Vibrant style** | ` Widget.Material3.DockedToolbar.Vibrant `
270-
271- Standard style theme attribute: ` ?attr/dockedToolbarStyle `
272- Vibrant style theme attribute: ` ?attr/dockedToolbarVibrantStyle `
273-
274- The default style is the standard style.
275-
276- Docked Toolbar also recommends a special style for specific components for when
277- they are inside of a docked toolbar. Currently, the Docked Toolbar styles also
278- include a theme overlay for ` ?attr/materialButtonStyle ` ,
279- ` ?attr/materialIconButtonStyle ` , and ` ?attr/borderlessButtonStyle ` to
280- style buttons inside of a Docked Toolbar.
281-
282- See the full list of
283- [ styles] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/dockedtoolbar/res/values/styles.xml ) and
284- [ docked toolbar attributes] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/dockedtoolbar/res/values/attrs.xml )
307+ ## Customizing docked toolbar
285308
286- ## Theming a Docked Toolbar
309+ ### Theming docked toolbar
287310
288- Docked Toolbar supports [ Material Theming] ( https://m3.material.io/foundations/customization ) ,
289- which can customize color and typography.
311+ Docked toolbars support the customization of color and typography.
290312
291- ### Docked Toolbar theming example
313+ #### Docked toolbar theming example
292314
293- The following example shows a Docked Toolbar with Material Theming .
315+ The following example shows a docked toolbar with Material theming .
294316
295- ![ Docked Toolbar theming example ] ( assets/dockedtoolbar/docked_toolbar_theming.png )
317+ < img src = " assets/dockedtoolbar/docked_toolbar_theming.png " alt = " Docked toolbar theming example " width = " 600 " >
296318
297- #### Implementing docked toolbar theming
319+ ##### Implementing docked toolbar theming
298320
299321Use theme attributes and a style in ` res/values/styles.xml ` which apply to all
300322docked toolbars and affect other components:
0 commit comments