이전 포스팅에서 RecyclerView.Adapter를 ListAdapter로 변경하면 에러가나는 모습을 보여드렸습니다. 이번 포스팅에선 ListAdapter에서 문제없이 ItemTouchHelper를 사용하는 방법을 적어보겠습니다. ListAdapter 우선 ListAdapter에 대해 간략히 알아보고 가겠습니다. RecyclerView.Adapter base class for presenting List data in a RecyclerView, including computing diffs between Lists on a background thread. This class is a convenience wrapper around AsyncListDiffer that implements Adapt..
RecyclerView의 아이템을 드래그 앤 드롭으로 순서를 변경하는 방법을 알아보겠습니다. RecyclerView의 아이템을 드래그&드롭할 때 onTouchListener, onInterceptTouchEvent, GestureDetector 등을 통해 이벤트 감지를 할 수 있지만, 안드로이드 RecyclerView 라이브러리에서 지원하는 ItemTuchHelper 클래스를 통해 쉽게 감지할 수 있습니다. ItemTuchHelper This is a utility class to add swipe to dismiss and drag & drop support to RecyclerView. It works with a RecyclerView and a Callback class, which configu..