This is an example of how it could have been done previously in the ListView
class, using the divider and dividerHeight parame
If anyone is looking to only add, say, 10dp spacing between items, you can do so by setting a drawable to DividerItemDecoration
:
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(
recyclerView.getContext(),
layoutManager.getOrientation()
);
dividerItemDecoration.setDrawable(
ContextCompat.getDrawable(getContext(), R.drawable.divider_10dp)
);
Where divider_10dp
is a drawable resource containing: