How to add dividers and spaces between items in RecyclerView?

前端 未结 30 3512
清歌不尽
清歌不尽 2020-11-22 03:27

This is an example of how it could have been done previously in the ListView class, using the divider and dividerHeight parame

30条回答
  •  我寻月下人不归
    2020-11-22 04:33

    Add a margin to your view, it worked for me.

    android:layout_marginTop="10dp"
    

    If you just want to add equal spacing and want to do it in XML, just set padding to your RecyclerView and equal amount of layoutMargin to the item you inflate into your RecyclerView, and let the background color determine the spacing color.

提交回复
热议问题