class DividerBuilder
Builds a divider for a LinearLayoutManager or its subclasses (e.g. GridLayoutManager). The following properties of a divider can be configured:
context - the Context used to build the divider.
fun asSpace(): DividerBuilder
Sets the divider as a simple space, so the divider leaves the space between two cells but it is not rendered. Since the rendering is totally skipped in this case, it's better than using a transparent color. |
|
fun build(): BaseDividerItemDecoration
Creates the RecyclerView.ItemDecoration using the configuration specified in this builder. If this builder doesn't specify the configuration of some divider's properties, those properties will be picked from the theme or their default will be used. |
|
fun color(color: Int): DividerBuilder
Sets the divider's drawable as a solid color. |
|
fun colorRes(colorRes: Int): DividerBuilder
Sets the divider's drawable as a solid color. |
|
fun drawable(drawable: Drawable): DividerBuilder
Sets the divider's drawable. |
|
fun drawableProvider(provider: DrawableProvider): DividerBuilder
Customizes the drawable of each divider in the grid. IMPORTANT: The default DividerOffsetProvider can't ensure the same size of the items in a grid when this method is called. If you want a different behavior, you can specify a custom DividerOffsetProvider with offsetProvider. |
|
fun drawableRes(drawableRes: Int): DividerBuilder
Sets the divider's drawable. |
|
fun insetEnd(end: Int): DividerBuilder
Sets the divider's end inset. The inset will behave as a margin/padding of the divider's drawable. The end inset in an horizontal divider is the right inset in left-to-right and the left inset in right-to-left. The end inset in a vertical divider is the bottom inset in top-to-bottom and the top inset in bottom-to-top. |
|
fun insetProvider(provider: InsetProvider): DividerBuilder
Customizes the insets of each divider in the grid. |
|
fun insets(start: Int, end: Int): DividerBuilder
Sets the divider's insets. The inset will behave as a margin/padding of the divider's drawable. The start inset in an horizontal divider is the left inset in left-to-right and the right inset in right-to-left. The start inset in a vertical divider is the top inset in top-to-bottom and the bottom inset in bottom-to-top. The end inset in an horizontal divider is the right inset in left-to-right and the left inset in right-to-left. The end inset in a vertical divider is the bottom inset in top-to-bottom and the top inset in bottom-to-top. |
|
fun insetStart(start: Int): DividerBuilder
Sets the divider's start inset. The inset will behave as a margin/padding of the divider's drawable. The start inset in an horizontal divider is the left inset in left-to-right and the right inset in right-to-left. The start inset in a vertical divider is the top inset in top-to-bottom and the bottom inset in bottom-to-top. |
|
fun offsetProvider(provider: DividerOffsetProvider): DividerBuilder
Customizes the offset of each divider in the grid. This method is useful to balance the size of the items in a grid with multiple columns/rows. |
|
fun showFirstDivider(): DividerBuilder
Shows the first divider of the list/grid. The first divider is the one before the items in the first line. |
|
fun showLastDivider(): DividerBuilder
Shows the last divider of the list/grid. The last divider is the one after the items in the last line. |
|
fun showSideDividers(): DividerBuilder
Shows the side dividers of the list/grid. The side dividers are the ones before the first column and after the last column. |
|
fun size(size: Int, sizeUnit: Int = TypedValue.COMPLEX_UNIT_PX): DividerBuilder
Sets the divider's size. The size of an horizontal divider is its height. The size of a vertical divider is its width. |
|
fun sizeProvider(provider: SizeProvider): DividerBuilder
Customizes the size of each divider in the grid. IMPORTANT: The default DividerOffsetProvider can't ensure the same size of the items in a grid when this method is called. If you want a different behavior, you can specify a custom DividerOffsetProvider with offsetProvider. |
|
fun tint(color: Int): DividerBuilder
Sets the tint color of the divider's drawable. |
|
fun tintProvider(provider: TintProvider): DividerBuilder
Customizes the tint color of each divider's drawable in the grid. |
|
fun visibilityProvider(provider: VisibilityProvider): DividerBuilder
Customizes the visibility of each divider in the grid. IMPORTANT: The default DividerOffsetProvider can't ensure the same size of the items in a grid when this method is called. If you want a different behavior, you can specify a custom DividerOffsetProvider with offsetProvider. |