recycler-view-divider / com.fondesa.recyclerviewdivider / StaggeredDividerBuilder / <init>
<init>
StaggeredDividerBuilder(context: Context)
Builds a divider for a StaggeredGridLayoutManager or its subclasses.
The following properties of a divider can be configured:
- asSpace
Makes 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.
The asSpace property can be defined in the theme with the attribute "recyclerViewDividerAsSpace".
By default it's false.
- color
Specifies the color of the divider used when it will be rendered.
The color of the divider can be defined in the theme with the attribute "recyclerViewDividerDrawable".
If it's not defined, it will be picked by the attribute "android:listDivider".
If the Android attribute's value is null, the divider won't be rendered and it will behave as a space.
There are two cases in which this builder can't ensure a correct rendering of a divider:
- If the value of "recyclerViewDividerDrawable" or "android:listDivider" is not a solid color.
- If the color of this divider is not completely opaque (contains some transparency).
- size
Specifies the divider's size.
The size of the divider can be defined in the theme with the attribute "recyclerViewDividerSize".
If it's not defined, the divider size will be inherited from the divider's drawable.
If it can't be inherited from the divider's drawable (e.g. the drawable is a solid color), the default size of 1dp will be used.
The size of an horizontal divider is its height.
The size of a vertical divider is its width.
- visibility
Specifies if a divider is visible or not.
When the divider isn't visible, it means the divider won't exist on the layout so its space between the two adjacent cells won't appear.
By default all the dividers are visible except the divider before the first items.
This happens because, apparently, it's not possible to understand which items will appear first in a StaggeredGridLayoutManager since
their positions can change.
Parameters
context - the Context used to build the divider.