RecyclerView item connected with vertical line

Viewed 99

I have a RecyclerView. In some cases I need to connect two items vertically to show the connection between them like in the image below:

enter image description here

The only thing I'm thinking about is to create another ViewHolder which will look like it was connected but this option will limit me in case I will need to connect three or more items and will have to create a ViewHolder for each case. Maybe someone has a better idea of how to achieve this goal? Thanks.

1 Answers

Use three Viewtypes.

1 Background Drawable with the space at the bottom 2. Drawable with 2 vertical lines
3 Background Drawable with the space at the top

Make sure there's no margin between the three recyclerview items with the different viewtypes

Related