I new to RecyclerView Selection library. I prepared RecyclerView
to select multiple item just single tap. My problem is that all of the article and tutorial show that selection process start with long press.
How can i overwrite to start selection with single tap? Thanks.
I'm using implementation 'androidx.recyclerview:recyclerview-selection:1.0.0'
The tutorial,I tried..
For single selection, we just need to hold the position that clicked in the recyclerview. When user clicks the another position, forget previous one and make new position as hold position.
Pretty much every single app has a list of something they want to display. RecyclerView Selection is a library that will allow you to handle item selection a lot easier. It will help you handle motion events and touch events, and convert them into selection in the RecyclerView.
After digging over weeks, I found working solution. According to 한로니
If you want single-tap to select, just override
inSelectionHotspot(e: MotionEvent)
to returntrue
object : ItemDetailsLookup.ItemDetails<Long>() {
override fun getSelectionKey(): Long? {
return itemId
}
override fun getPosition(): Int {
return adapterPosition
}
override fun inSelectionHotspot(e: MotionEvent): Boolean {
return true
}
For more u can see on Here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With