How to add dividers and spaces between items in RecyclerView?

前端 未结 30 3548
清歌不尽
清歌不尽 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:09

    • Here is simple hack to add divider
    • Just add a background to the layout of your recycler item as follows

      
      
      
      
      
      
      
      
      
      
      
      
      
      
      

    Create following shape_border.xml in drawable folder

      
        
           
        
    

    Here is final result - a RecyclerView with divider.

提交回复
热议问题