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
Autoplay

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

External Resources

Check this excellent blog post, by Paul Burke for details about the implementation shown in this lesson.

Android References

ItemTouchHelper

ItemTouchHelper.Callback

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in RecyclerView