0

can anyone explain the difference between DividerItemDecoration and LinearLayoutManager?

when should i use DividerItemDecoration and when should i use LinearLayoutManager in recycler view?

1 Answers1

0

LinearLayoutManager and DividerItemDecoration has entirely different use cases.

When you use a RecyclerView, you need to specify a LayoutManager that is responsible for laying out each item in the view. The LinearLayoutManager is a type of LayoutManager which allows you to specify an orientation, just like a normal LinearLayout would.

DividerItemDecoration is a RecyclerView.ItemDecoration that can be used as a divider between items of a LinearLayoutManager. For providing spaces or divider between your RecyclerView item you can use DividerItemDecoration.

LinearLayoutManager is explained in this answer

DividerItemDecoration is explained in this answer

Bincy Baby
  • 3,941
  • 5
  • 36
  • 62