Package 

Class DividerItemDecoration

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static int HORIZONTAL
      public final static int VERTICAL
    • Method Summary

      Modifier and Type Method Description
      void setOrientation(int orientation) Sets the orientation for this divider.
      void setDrawable(@NonNull() Drawable drawable) Sets the Drawable for this divider.
      Drawable getDrawable()
      void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) Draw any appropriate decorations into the Canvas supplied to the RecyclerView.Any content drawn by this method will be drawn before the item views are drawn,and will thus appear underneath the views.
      void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) Retrieve any offsets for the given item.
      • Methods inherited from class tds.androidx.recyclerview.widget.RecyclerView.ItemDecoration

        getItemOffsets, getItemOffsets, onDraw, onDraw, onDrawOver, onDrawOver
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DividerItemDecoration

        DividerItemDecoration(Context context, int orientation)
        Creates a divider RecyclerView.ItemDecoration that can be used with a LinearLayoutManager.
        Parameters:
        context - Current context, it will be used to access resources.
        orientation - Divider orientation.
    • Method Detail

      • onDraw

         void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state)

        Draw any appropriate decorations into the Canvas supplied to the RecyclerView.Any content drawn by this method will be drawn before the item views are drawn,and will thus appear underneath the views.

        Parameters:
        c - Canvas to draw into
        parent - RecyclerView this ItemDecoration is drawing into
        state - The current state of RecyclerView
      • getItemOffsets

         void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)

        Retrieve any offsets for the given item. Each field of outRect specifiesthe number of pixels that the item view should be inset by, similar to padding or margin.The default implementation sets the bounds of outRect to 0 and returns.

        If this ItemDecoration does not affect the positioning of item views, it should setall four fields of outRect (left, top, right, bottom) to zerobefore returning.

        If you need to access Adapter for additional data, you can call getChildAdapterPosition to get the adapter position of theView.

        Parameters:
        outRect - Rect to receive the output.
        view - The child view to decorate
        parent - RecyclerView this ItemDecoration is decorating
        state - The current state of RecyclerView.