Sign in Go Pro

RecyclerView

Drag & Drop and Swipe to Dismiss using ItemTouchHelper

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next

Previous

About

This lesson will show how to add gesture-based controls to your RecyclerView using ItemTouchHelper. It is a utility class designed to make it easy to add swipe to dismiss and drag & drop support to RecyclerView. #### Lesson Objectives * Define the ItemTouchHelper class * Show how the ItemTouchHelper.Callback class is used to * Control which gestures are enabled * Receive callbacks based on user events * Implement Swipe to Dismiss (swipe a list Item to remove it) * Implement Drag & Drop (drag items in a list to re-arrange the order) #### Gist with classes to copy into project [Gist: Interfaces and ItemTouchHelper.Callback](https://gist.github.com/mwolfson/04f4b7b8b39951dda3375cecf8d91f5a?utm_src=casterio) #### External Resources Check this excellent [blog post](https://medium.com/@ipaulpro/drag-and-swipe-with-recyclerview-b9456d2b1aaf?utm_src=casterio), by [Paul Burke](https://twitter.com/iPaulPro?utm_src=casterio) for details about the implementation shown in this lesson. #### Android References [ItemTouchHelper](https://developer.android.com/reference/android/support/v7/widget/helper/ItemTouchHelper.html?utm_src=casterio) [ItemTouchHelper.Callback](https://developer.android.com/reference/android/support/v7/widget/helper/ItemTouchHelper.Callback.html?utm_src=casterio)

Lessons in RecyclerView