Dividers Recyclerview Android

only work with Linear Layout Manager

private DividerItemDecoration mDividerItemDecoration;

Default android divider

mRecyclerView.addItemDecoration(
new DividerItemDecoration(getActivity(), null));

Custom divider with first also end and last dividers

mDividerItemDecoration = new DividerItemDecoration(this, linearLayoutManager.getOrientation());
mDividerItemDecoration.setDrawable(this.getResources().getDrawable(R.drawable.list_line_divider));
mList.addItemDecoration(mDividerItemDecoration);

reference : https://gist.github.com/lapastillaroja/858caf1a82791b6c1a36