Sign in Go Pro


Using ItemDecoration to Add Dividers to a List

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



In this video I am going show how to add dividers between your list items. To add dividers, we will use a facility built into RecyclerView named [ItemDecoration](, which is a special class that allows the application to draw offsets and drawables onto a RecyclerView. ####Lesson Objectives * Add list dividers to RecylerView that uses Linear, Grid, and StaggaredGrid Layout Managers * Show how to write and use a custom ItemDecoration class * Explain how\when to use ItemDecoration methods: onDraw(), onDrawOver(), and getItemOffsets() * Proper way to access adapter information from class (using getChildAdapterPosition()) * Using CardView for variably sized content ####Material Design Reference for Divider Usage There is excellent guidance about using [lists]( that is worth reading. The information about using [cards]( is particularly relevant to this lesson. #### Android References [ItemDecoration]( [DividerItemDecoration]( [CardView](

Lessons in RecyclerView