Skip to content

Commit cc2390f

Browse files
Material Design Teamdrchen
authored andcommitted
[Docs] Updated documentation with additional code/info and updated the nomenclature of images in the following docs:
1. BottomSheet 2. Checkbox 3. DatePicker 4. Divider 5. Menu 6. RadioButton 7. Snackbar 8. TimePicker PiperOrigin-RevId: 799044653
1 parent 2b29a26 commit cc2390f

File tree

69 files changed

+102
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+102
-71
lines changed

docs/components/BottomSheet.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ path: /catalog/bottom-sheet-behavior/
1313
secondary content anchored to the bottom of the screen. There are two variants
1414
of bottom sheets.
1515

16-
![Bottom sheets types](assets/bottomsheet/bottomsheets_types.png)
16+
![Bottom sheets types](assets/bottomsheet/bottomsheets-types.png)
1717

1818
1. Standard bottom sheet
1919
2. Modal bottom sheet
@@ -30,7 +30,7 @@ of bottom sheets.
3030
Modal bottom sheets are above a scrim while standard bottom sheets don't have a
3131
scrim. Besides this, both types of bottom sheets have the same specs.
3232

33-
![Bottom sheet anatomy](assets/bottomsheet/bottomsheet_anatomy.png)
33+
![Bottom sheet anatomy](assets/bottomsheet/bottomsheet-anatomy.png)
3434

3535
1. Container
3636
2. Drag handle (optional)
@@ -126,7 +126,7 @@ expanded states:
126126

127127
Collapsed <div style="width:400px"></div> | Expanded <div style="width:400px"></div>
128128
--------------------------------------------------------------------------------------------------------------------- | ----------------------------------------
129-
<img src="assets/bottomsheet/bottomsheet_standard1.png" alt="Standard collapsed bottom sheet example." height="500"/> | <img src="assets/bottomsheet/bottomsheet_standard2.png" alt="Standard expanded bottom sheet example." height="500"/>
129+
<img src="assets/bottomsheet/bottomsheet-standard1.png" alt="Standard collapsed bottom sheet example." height="500"/> | <img src="assets/bottomsheet/bottomsheet-standard2.png" alt="Standard expanded bottom sheet example." height="500"/>
130130

131131
`BottomSheetBehavior` works in tandem with `CoordinatorLayout` to let you
132132
display content on a bottom sheet, perform enter/exit animations, respond to
@@ -224,7 +224,7 @@ states:
224224

225225
Collapsed <div style="width:400px"></div> | Expanded <div style="width:400px"></div>
226226
--------------------------------------------------------------------------------------------------------------- | ----------------------------------------
227-
<img src="assets/bottomsheet/bottomsheet_modal1.png" alt="Modal collapsed bottom sheet example." height="500"/> | <img src="assets/bottomsheet/bottomsheet_modal2.png" alt="Modal expanded bottom sheet example." height="500"/>
227+
<img src="assets/bottomsheet/bottomsheet-modal1.png" alt="Modal collapsed bottom sheet example." height="500"/> | <img src="assets/bottomsheet/bottomsheet-modal2.png" alt="Modal expanded bottom sheet example." height="500"/>
228228

229229
First, subclass `BottomSheetDialogFragment` and overwrite `onCreateView` to
230230
provide a layout for the contents of the sheet (in this example, it's
@@ -550,7 +550,7 @@ API and source code:
550550
The following example shows a bottom sheet with Material theming, in its
551551
collapsed and expanded states.
552552

553-
<img src="assets/bottomsheet/bottomsheet_theming.png" alt="Bottom sheet with pink background color. Collapsed on the left and expanded on the right." height="550"/>
553+
<img src="assets/bottomsheet/bottomsheet-theming.png" alt="Bottom sheet with pink background color. Collapsed on the left and expanded on the right." height="550"/>
554554

555555
##### Implementing bottom sheet theming
556556

docs/components/Checkbox.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ path: /catalog/checkboxes/
1212
[Checkboxes](https://m3.material.io/components/checkbox/overview) let users
1313
select one or more items from a list, or turn an item on or off.
1414

15-
<img src="assets/checkbox/checkbox_hero.png" alt="Checkbox hero: meal options header, additions checkbox, pickles, lettuce, tomato, checkboxes with lettuce checked" width="900">
15+
<img src="assets/checkbox/checkbox-hero.png" alt="Checkbox hero: meal options header, additions checkbox, pickles, lettuce, tomato, checkboxes with lettuce checked" width="900">
1616

1717
**Note:** Images use various dynamic color schemes.
1818

@@ -23,7 +23,7 @@ select one or more items from a list, or turn an item on or off.
2323

2424
## Anatomy
2525

26-
![Checkbox anatomy diagram](assets/checkbox/checkbox_anatomy.png)
26+
![Checkbox anatomy diagram](assets/checkbox/checkbox-anatomy.png)
2727

2828
1. Container
2929
2. Icon
@@ -64,7 +64,7 @@ Element | Attribute | Related method(s) |
6464
Checkboxes can be selected, unselected, or indeterminate, and those states on
6565
error. Checkboxes have enabled, disabled, hover, focused, and pressed states.
6666

67-
<img src="assets/checkbox/checkbox_states.png" alt="Checkbox states in an array. Columns are enabled, disabled, hover, focused, pressed. Rows are selected, unselected, or indeterminite, and selected on error, unselected on error, or indeterminate on error." width="700">
67+
<img src="assets/checkbox/checkbox-states.png" alt="Checkbox states in an array. Columns are enabled, disabled, hover, focused, pressed. Rows are selected, unselected, or indeterminite, and selected on error, unselected on error, or indeterminate on error." width="700">
6868

6969
1. Enabled
7070
2. Disabled
@@ -112,7 +112,7 @@ The first checkbox (the parent) will be selected if all children are selected,
112112
not selected if all of the children are not selected, and indeterminate if only
113113
some of the children are selected.
114114

115-
<img src="assets/checkbox/checkbox_example.png" alt="Example of 5 checkboxes, the first one is the parent and the ones below it are the children." height="350">
115+
<img src="assets/checkbox/checkbox-example.png" alt="Example of 5 checkboxes, the first one is the parent and the ones below it are the children." height="350">
116116

117117
In the layout:
118118

@@ -291,7 +291,7 @@ checkbox.errorAccessibilityLabel = "Error: custom error announcement."
291291

292292
### Making checkbox indeterminate
293293

294-
![Checkbox states - unselected, selected(hover), and indeterminate checkboxes](assets/checkbox/checkbox_checked_unchecked_.png)
294+
![Checkbox states - unselected, selected(hover), and indeterminate checkboxes](assets/checkbox/checkbox-checked-unchecked.png)
295295
Unselected, selected (hover), and indeterminate checkboxes
296296

297297
In the layout:
@@ -334,7 +334,7 @@ API and source code:
334334

335335
The following example shows a checkbox with Material theming.
336336

337-
<img src="assets/checkbox/checkbox_theming.png" alt="A parent checkbox and
337+
<img src="assets/checkbox/checkbox-theming.png" alt="A parent checkbox and
338338
children checkboxes. They container is pink, the outline is brown, and the icon
339339
is white." height="350">
340340

docs/components/DatePicker.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ path: /catalog/date-pickers/
1212
[Date pickers](https://material.io/components/date-pickers) let users select a
1313
date or range of dates.There are three variants of date pickers.
1414

15-
<img src="assets/datepicker/datepickers_types.png" alt="Date picker and range picker examples."/>
15+
<img src="assets/datepicker/datepickers-types.png" alt="Date picker and range picker examples."/>
1616

1717
1. Docked date picker
1818
2. Modal date picker
@@ -31,7 +31,7 @@ date or range of dates.There are three variants of date pickers.
3131

3232
<summary><h4>Docked date picker</h4></summary>
3333

34-
<img src="assets/datepicker/dockeddatepicker_anatomy1.png" alt="10 elements of a docked date picker." height="600"/>
34+
<img src="assets/datepicker/dockeddatepicker-anatomy1.png" alt="10 elements of a docked date picker." height="600"/>
3535

3636
1. Outlined text field
3737
2. Menu button: Month selection
@@ -44,7 +44,7 @@ date or range of dates.There are three variants of date pickers.
4444
9. Text buttons
4545
10. Container
4646

47-
<img src="assets/datepicker/dockeddatepicker_anatomy2.png" alt="8 elements of a docked date picker." height="600"/>
47+
<img src="assets/datepicker/dockeddatepicker-anatomy2.png" alt="8 elements of a docked date picker." height="600"/>
4848

4949
1. Outlined text field
5050
2. Menu button: Month selection (pressed)
@@ -61,7 +61,7 @@ date or range of dates.There are three variants of date pickers.
6161

6262
<summary><h4>Modal date picker</h4></summary>
6363

64-
<img src="assets/datepicker/modaldatepicker_anatomy1.png" alt="13 elements of a modal date picker." height="600"/>
64+
<img src="assets/datepicker/modaldatepicker-anatomy1.png" alt="13 elements of a modal date picker." height="600"/>
6565

6666
1. Headline
6767
2. Supporting text
@@ -71,12 +71,13 @@ date or range of dates.There are three variants of date pickers.
7171
6. Icon buttons
7272
7. Weekdays
7373
8. Today’s date
74-
9. Unselected date 10.Text buttons
75-
10. Selected date
76-
11. Menu button
77-
12. Divider
74+
9. Unselected date
75+
10. Text buttons
76+
11. Selected date
77+
12. Menu button
78+
13. Divider
7879

79-
<img src="assets/datepicker/modaldatepicker_anatomy2.png" alt="10 elements of a modal date picker." height="600"/>
80+
<img src="assets/datepicker/modaldatepicker-anatomy2.png" alt="10 elements of a modal date picker." height="600"/>
8081

8182
1. Headline
8283
2. Supporting text
@@ -86,9 +87,10 @@ date or range of dates.There are three variants of date pickers.
8687
6. Unselected year
8788
7. Selected year
8889
8. Text buttons
89-
9. Divider 10 Menu button
90+
9. Divider
91+
10. Menu button
9092

91-
<img src="assets/datepicker/modaldatepicker_anatomy3.png" alt="15 elements of a modal date picker." height="650"/>
93+
<img src="assets/datepicker/modaldatepicker-anatomy3.png" alt="15 elements of a modal date picker." height="650"/>
9294

9395
1. Headline
9496
2. Supporting text
@@ -112,7 +114,7 @@ date or range of dates.There are three variants of date pickers.
112114

113115
<summary><h4>Modal date input</h4></summary>
114116

115-
<img src="assets/datepicker/modaldateinput_anatomy.png" alt="8 elements of a modal date input."/>
117+
<img src="assets/datepicker/modaldateinput-anatomy.png" alt="8 elements of a modal date input."/>
116118

117119
1. Headline
118120
2. Supporting text
@@ -267,7 +269,7 @@ app:layout_constraintTop_toTopOf="parent"
267269
app:endIconMode="custom"
268270
app:endIconDrawable="@drawable/ic_android_black_24dp"
269271
app:endIconContentDescription="Open Date Picker"
270-
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
272+
style="?attr/textInputOutlinedStyle">
271273
272274
<com.google.android.material.textfield.TextInputEditText
273275
android:id="@+id/booking_date_edit_text"
@@ -358,7 +360,7 @@ datePicker.show()
358360
The following example shows a **modal date range picker** with a date range
359361
selected.
360362

361-
<img src="assets/datepicker/datepickers_range_example.png" alt="Date range picker with September, 20 to September, 24 selected" height="700"/>
363+
<img src="assets/datepicker/datepickers-range-example.png" alt="Date range picker with September, 20 to September, 24 selected" height="700"/>
362364

363365
In code:
364366

@@ -599,7 +601,7 @@ API and source code:
599601

600602
The following example shows a date picker with Material theming.
601603

602-
<img src="assets/datepicker/datepickers_hero.png" alt="Mobile date picker for September 2021 with '21' selected." height="637"/>
604+
<img src="assets/datepicker/datepickers-hero.png" alt="Mobile date picker for September 2021 with '21' selected." height="637"/>
603605

604606
Use theme attributes and styles in `res/values/styles.xml`, which apply to all
605607
date pickers and affect other components:

docs/components/Divider.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ that group content in lists or other containers. Dividers are one way to
1414
visually group components and create hierarchy. They can also be used to imply
1515
nested parent/child relationships.
1616

17-
![Divider with full width](assets/dividers/divider_fullwidth.png)
17+
![Divider with full width](assets/dividers/divider-fullwidth.png)
1818

1919
**Note:** Images use various dynamic color schemes.
2020

@@ -25,7 +25,7 @@ nested parent/child relationships.
2525

2626
## Anatomy
2727

28-
![Anatomy of a divider](assets/dividers/divider_anatomy.png)
28+
![Anatomy of a divider](assets/dividers/divider-anatomy.png)
2929

3030
1. Divider
3131

@@ -64,7 +64,7 @@ There are two types of dividers:
6464

6565
### Full width divider
6666

67-
<img src="assets/dividers/divider_full_width_type.png" alt="Full width divider" height="350">
67+
<img src="assets/dividers/divider-full-width-type.png" alt="Full width divider" height="350">
6868
Full width dividers to indicate separation of content
6969

7070
Full width dividers separate larger sections of unrelated content. They also
@@ -73,7 +73,7 @@ on a surface or inside other components like cards or lists.
7373

7474
### Inset divider
7575

76-
<img src="assets/dividers/divider_inset.png" alt="Inset divider" height="400">
76+
<img src="assets/dividers/divider-inset.png" alt="Inset divider" height="400">
7777
Inset divider to indicate separation of content
7878

7979
Inset dividers separate related content within a section. They are equally
@@ -102,7 +102,7 @@ into clear groups.
102102

103103
The full-bleed divider is displayed below:
104104

105-
![Gray full-bleed divider example](assets/dividers/divider_view.png)
105+
![Gray full-bleed divider example](assets/dividers/divider-view.png)
106106

107107
On the layout:
108108

@@ -130,6 +130,31 @@ divider.setDividerInsetStart(insetStart)
130130
divider.setDividerInsetEnd(insetEnd)
131131
```
132132

133+
### Adding heavy divider
134+
135+
![Heavy divider example](assets/dividers/heavy-divider.png)
136+
137+
Heavy dividers are used for indicating a visual break or stop between major
138+
sections in a long page. They are used as an additional level of visual
139+
differentiation and hierarchy within a layout.
140+
141+
Note: Make sure to set `android:layout_height="wrap_content"` on the
142+
`MaterialDivider` to ensure that the correct size is set for the divider.
143+
144+
```xml
145+
<com.google.android.material.divider.MaterialDivider
146+
style="?attr/materialDividerHeavyStyle"
147+
android:layout_width="match_parent"
148+
android:layout_height="wrap_content"
149+
android:layout_marginTop="16dp"
150+
android:layout_marginBottom="16dp" />
151+
```
152+
153+
Note: Heavy dividers are automatically used as the default for dividers set to
154+
`?attr/materialDividerHeavyStyle`, which points to
155+
`@style/Widget.Material3.MaterialDivider.Heavy`. To get the heavy divider,
156+
you should set the divider style to `?attr/materialDividerHeavyStyle`.
157+
133158
### Adding `MaterialDividerItemDecoration`
134159

135160
API and source code:
@@ -142,9 +167,13 @@ The `MaterialDividerItemDecoration` is a `RecyclerView.ItemDecoration`, similar
142167
to a `DividerItemDecoration`, that can be used as a divider between items of a
143168
`LinearLayoutManager`. It supports both horizontal and vertical orientations.
144169

170+
Divider in a vertically oriented RecyclerView:
171+
172+
![Vertical divider example](assets/dividers/vertical-divider.png)
173+
145174
A list with full-bleed dividers is displayed below:
146175

147-
<img src="assets/dividers/divider_itemdecoration.png" alt="Vertical list of five items with five gray dividers after each item" height="300">
176+
<img src="assets/dividers/divider-itemdecoration.png" alt="Vertical list of five items with five gray dividers after each item" height="300">
148177

149178
In code:
150179

@@ -156,7 +185,7 @@ recyclerView.addItemDecoration(divider)
156185
By default, dividers will be full-bleed. To achieve the look of an inset or
157186
middle divider:
158187

159-
<img src="assets/dividers/divider_itemdecoration_inset.png" alt="Vertical list of five items with five gray dividers that have a start inset" height="300">
188+
<img src="assets/dividers/divider-itemdecoration-inset.png" alt="Vertical list of five items with five gray dividers that have a start inset" height="300">
160189

161190
In code:
162191

@@ -167,7 +196,7 @@ divider.setDividerInsetEnd(insetEnd)
167196

168197
Optionally, you can hide the last divider of a list:
169198

170-
<img src="assets/dividers/divider_itemdecoration_hiddendivider.png" alt="Vertical list of five items with four gray dividers" height="300">
199+
<img src="assets/dividers/divider-itemdecoration-hiddendivider.png" alt="Vertical list of five items with four gray dividers" height="300">
171200

172201
In code:
173202

@@ -199,7 +228,7 @@ API and source code:
199228

200229
The following example shows a divider with Material theming.
201230

202-
<img src="assets/dividers/divider_theming.png" alt="Pink full-bleed divider" width="850">
231+
<img src="assets/dividers/divider-theming.png" alt="Pink full-bleed divider" width="850">
203232

204233
##### Implementing divider theming
205234

0 commit comments

Comments
 (0)