MaterialDividerItemDecoration

MaterialDividerItemDecoration is a RecyclerView.ItemDecoration, similar to a , that can be used as a divider between items of a LinearLayoutManager. It supports both HORIZONTAL and VERTICAL orientations.

    dividerItemDecoration = new MaterialDividerItemDecoration(recyclerView.getContext(),
            layoutManager.getOrientation());
    recyclerView.addItemDecoration(dividerItemDecoration);

For more information, see the component developer guidance and design guidelines.

Constructors

Link copied to clipboard
constructor(@NonNull context: Context, orientation: Int)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet, orientation: Int)
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet, defStyleAttr: Int, orientation: Int)

Properties

Link copied to clipboard
val HORIZONTAL: Int = 0
Link copied to clipboard
open var orientation: Int
Link copied to clipboard
val VERTICAL: Int = 1

Functions

Link copied to clipboard
Returns the divider color.
Link copied to clipboard
Returns the divider's end inset.
Link copied to clipboard
Returns the divider's start inset.
Link copied to clipboard
Returns the thickness set on the divider.
Link copied to clipboard
open fun getItemOffsets(@NonNull outRect: Rect, @NonNull view: View, @NonNull parent: RecyclerView, @NonNull state: RecyclerView.State)
Link copied to clipboard
Whether there's a divider after the last item of a RecyclerView.
Link copied to clipboard
open fun onDraw(@NonNull canvas: Canvas, @NonNull parent: RecyclerView, @NonNull state: RecyclerView.State)
Link copied to clipboard
open fun setDividerColor(@ColorInt color: Int)
Sets the color of the divider.
Link copied to clipboard
open fun setDividerColorResource(@NonNull context: Context, @ColorRes colorId: Int)
Sets the color of the divider.
Link copied to clipboard
open fun setDividerInsetEnd(@Px insetEnd: Int)
Sets the end inset of the divider.
Link copied to clipboard
open fun setDividerInsetEndResource(@NonNull context: Context, @DimenRes insetEndId: Int)
Sets the end inset of the divider.
Link copied to clipboard
open fun setDividerInsetStart(@Px insetStart: Int)
Sets the start inset of the divider.
Link copied to clipboard
open fun setDividerInsetStartResource(@NonNull context: Context, @DimenRes insetStartId: Int)
Sets the start inset of the divider.
Link copied to clipboard
open fun setDividerThickness(@Px thickness: Int)
Sets the thickness of the divider.
Link copied to clipboard
open fun setDividerThicknessResource(@NonNull context: Context, @DimenRes thicknessId: Int)
Sets the thickness of the divider.
Link copied to clipboard
open fun setLastItemDecorated(lastItemDecorated: Boolean)
Sets whether the class should draw a divider after the last item of a RecyclerView.