@@ -9,29 +9,67 @@ path: /catalog/dividers/
99
1010# Dividers
1111
12- [ Dividers] ( https://material.io/components/dividers ) separate content into clear
13- groups.
12+ [ Dividers] ( https://m3.material.io/components/divider/overview ) are thin lines
13+ that group content in lists or other containers. There are two variants of
14+ dividers.
15+
16+ <table >
17+ <tr >
18+ <td ><img src =" assets/dividers/divider_fullwidth.png " alt =" divider with full width " ></td >
19+ <td ><img src =" assets/dividers/divider_inset.png " alt =" Inset " ></td >
20+ </tr >
21+ <tr >
22+ <td style =" text-align : center ;" >Full-width</td >
23+ <td style =" text-align : center ;" >Inset</td >
24+ </tr >
25+ </table >
26+
27+ ** Note:** Images use various dynamic color schemes.
1428
15- ![ Dividers in a layout] ( assets/dividers/divider_hero.png )
29+ Before you can use Material dividers, you need to add a dependency to the
30+ Material components for Android library. For more information, go to the
31+ [ Getting started] ( https://github.com/material-components/material-components-android/tree/master/docs/getting-started.md )
32+ page.
1633
17- ** Contents **
34+ ## Design & API documentation
1835
19- * [ Design and API Documentation] ( #design-and-api-documentation )
20- * [ Using dividers] ( #using-dividers )
21- * [ Divider's key properties] ( #key-properties )
22- * [ Theming dividers] ( #theming-dividers )
36+ * [ Material 3 (M3) spec] ( https://m3.material.io/components/divider/overview )
37+ * [ API reference] ( https://developer.android.com/reference/com/google/android/material/divider/package-summary )
2338
24- ## Design and API Documentation
39+ ## Anatomy
2540
26- * [ Google Material3 Spec] ( https://material.io/components/divider/overview )
27- * [ API reference] ( https://developer.android.com/reference/com/google/android/material/divider/package-summary )
41+ ![ Anatomy of a divider] ( assets/dividers/divider_anatomy.png )
2842
29- ## Using dividers
43+ 1 . Divider
3044
31- Before you can use Material dividers, you need to add a dependency to the
32- Material Components for Android library. For more information, go to the
33- [ Getting started] ( https://github.com/material-components/material-components-android/tree/master/docs/getting-started.md )
34- page.
45+ More details on anatomy items in the [ component guidelines] ( https://m3.material.io/components/divider/guidelines#b56e93b4-b56d-4e12-bd9f-68ce55132cc4 ) .
46+
47+ ## Key properties
48+
49+ ### Dividers attributes
50+
51+ Element | Attribute | Related method(s) | Default value
52+ ----------------------- | ----------------------- | ------------------------------------------------------------------------------------ | -------------
53+ ** Thickness** | ` app:dividerThickness ` | ` setDividerThickness ` <br />` setDividerThicknessResource ` <br />` getDividerThickness ` | ` 1dp ` for the regular divider <br /> ` 8dp ` for the heavy divider
54+ ** Color** | ` app:dividerColor ` | ` setDividerColor ` <br />` setDividerColorResource ` <br />` getDividerColor ` | ` ?attr/colorOutlineVariant `
55+ ** Start inset** | ` app:dividerInsetStart ` | ` setDividerInsetStart ` <br />` setDividerInsetStartResource ` <br />` getDividerInsetStart ` | ` 0dp `
56+ ** End inset** | ` app:dividerInsetEnd ` | ` setDividerInsetEnd ` <br />` setDividerInsetEndResource ` <br />` getDividerInsetEnd ` | ` 0dp `
57+ ** Last item decorated** | ` app:lastItemDecorated ` | ` setLastItemDecorated ` <br />` isLastItemDecorated ` | ` true `
58+
59+ ### Styles
60+
61+ Element | Style
62+ ----------------- | -------------------------------------------
63+ ** Default style** | ` Widget.Material3.MaterialDivider `
64+
65+ Default style theme attribute: ` ?attr/materialDividerStyle `
66+
67+ For the full list, see
68+ [ styles] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/divider/res/values/styles.xml )
69+ and
70+ [ attrs] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/divider/res/values/attrs.xml ) .
71+
72+ ## Code implementation
3573
3674### ` MaterialDivider `
3775
@@ -76,7 +114,6 @@ Or in code:
76114divider.setDividerInsetStart(insetStart)
77115divider.setDividerInsetEnd(insetEnd)
78116```
79-
80117### ` MaterialDividerItemDecoration `
81118
82119API and source code:
@@ -91,7 +128,7 @@ to a `DividerItemDecoration`, that can be used as a divider between items of a
91128
92129A list with full-bleed dividers is displayed below:
93130
94- ![ Vertical list of five items with five gray dividers after each item] ( assets/dividers/divider_itemdecoration.png )
131+ < img src = " assets/dividers/divider_itemdecoration.png " alt = " Vertical list of five items with five gray dividers after each item " height = " 300 " >
95132
96133In code:
97134
@@ -103,7 +140,7 @@ recyclerView.addItemDecoration(divider)
103140By default, dividers will be full-bleed. To achieve the look of an inset or
104141middle divider:
105142
106- ![ Vertical list of five items with five gray dividers that have a start inset] ( assets/dividers/divider_itemdecoration_inset.png )
143+ < 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 " >
107144
108145In code:
109146
@@ -114,50 +151,26 @@ divider.setDividerInsetEnd(insetEnd)
114151
115152Optionally, you can hide the last divider of a list:
116153
117- ![ Vertical list of five items with four gray dividers] ( assets/dividers/divider_itemdecoration_hiddendivider.png )
154+ < img src = " assets/dividers/divider_itemdecoration_hiddendivider.png " alt = " Vertical list of five items with four gray dividers " height = " 300 " >
118155
119156In code:
120157
121158``` kt
122159divider.setLastItemDecorated(false )
123160```
124161
125- ### Making dividers accessible
162+ ## Making dividers accessible
126163
127164The divider is a decorative element. There are no special accessibility
128165precautions for the divider.
129166
130- ## Key properties
131-
132- ### Dividers attributes
133-
134- Element | Attribute | Related method(s) | Default value
135- ----------------------- | ----------------------- | ------------------------------------------------------------------------------------ | -------------
136- ** Thickness** | ` app:dividerThickness ` | ` setDividerThickness ` <br />` setDividerThicknessResource ` <br />` getDividerThickness ` | ` 1dp ` for the regular divider <br /> ` 8dp ` for the heavy divider
137- ** Color** | ` app:dividerColor ` | ` setDividerColor ` <br />` setDividerColorResource ` <br />` getDividerColor ` | ` ?attr/colorOutlineVariant `
138- ** Start inset** | ` app:dividerInsetStart ` | ` setDividerInsetStart ` <br />` setDividerInsetStartResource ` <br />` getDividerInsetStart ` | ` 0dp `
139- ** End inset** | ` app:dividerInsetEnd ` | ` setDividerInsetEnd ` <br />` setDividerInsetEndResource ` <br />` getDividerInsetEnd ` | ` 0dp `
140- ** Last item decorated** | ` app:lastItemDecorated ` | ` setLastItemDecorated ` <br />` isLastItemDecorated ` | ` true `
141-
142- ### Styles
143-
144- Element | Style
145- ----------------- | -------------------------------------------
146- ** Default style** | ` Widget.Material3.MaterialDivider `
147-
148- Default style theme attribute: ` ?attr/materialDividerStyle `
149-
150- See the full list of
151- [ styles] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/divider/res/values/styles.xml )
152- and
153- [ attrs] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/divider/res/values/attrs.xml ) .
167+ ## Customizing dividers
154168
155- ## Theming dividers
169+ ### Theming dividers
156170
157- Dividers support
158- [ Material Theming] ( https://material.io/components/selection-controls#theming ) and therefore can have their colors customized.
171+ Dividers support the customization of color.
159172
160- ### Divider theming example
173+ #### Divider theming example
161174
162175API and source code:
163176
@@ -168,11 +181,11 @@ API and source code:
168181 * [ Class definition] ( https://developer.android.com/reference/com/google/android/material/divider/MaterialDividerItemDecoration )
169182 * [ Class source] ( https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/divider/MaterialDividerItemDecoration.java )
170183
171- The following example shows a divider with Material Theming .
184+ The following example shows a divider with Material theming .
172185
173- ![ Pink full-bleed divider ] ( assets/dividers/divider_theming.png )
186+ < img src = " assets/dividers/divider_theming.png " alt = " Pink full-bleed divider " width = " 850 " >
174187
175- #### Implementing divider theming
188+ ##### Implementing divider theming
176189
177190Use theme attributes in ` res/values/styles.xml ` , which applies to all dividers
178191and affects other components:
0 commit comments