How to disable drag to select in RecyclerView SelectionTracker?

Viewed 993

I need to disable the drag to select feature of RecyclerView selection tracker. Currently after long press item gets selected and if I continue dragging continuous items are selected. I need to ensure that rest items are not selected.

Tried working something with the inbuild implementations but nothing worked.

1 Answers

In your SelectionTracker.Builder there is a method withSelectionPredicate(SelectionPredicate). You can define your own SelectionPredicate and implement its abstract method canSelectMultiple to return false - with this you will be able to select only the single item.

Hope it helps.

Related