Open kokilaw opened 6 years ago
Did you change getItemViewType, onCreateViewHolder and onBindViewHolder methods in your adapter class?
Yes. RecylerView is working fine with different view types. Drag and drop between different view types is the place that that I'm stuck at.
To decide if a viewHolder should be drag-able and/or swipe-able, I think you need to do it in the getMovementFlags
function. There you have a change to decide if you want to allow drag and/or swipe for the given ViewHolder.
To decide if a viewHolder can be switched with another one, you have onMove
.
Here, made a sample for this :
https://github.com/AndroidDeveloperLB/RecyclerViewDragAndDropTest
Weird thing is that the animation might be weird in some cases. Reported it here: https://issuetracker.google.com/issues/138465468
I need to implement the drag and drop for items with different view types. I tried with following code
without
but it doesn't work as I expected. I'm using a grid layout by the way.