Open akifsabeh opened 5 years ago
i too request for this feature
Hi guys @akifsabeh , @root-ansh I tried this, and it works fine
recyclerView.onFlingListener = object : RecyclerView.OnFlingListener() {
override fun onFling(velocityX: Int, velocityY: Int): Boolean {
if (abs(velocityX) > 3000) {
var cur = layoutManager.centerItemPosition
if (velocityX > 0) {
cur += 1
} else {
cur -= 1
}
if (cur >= list.size) {
cur = 0
} else if (cur < 0) {
cur = list.size - 1
}
recyclerView.smoothScrollToPosition(cur)
return true
}
return false
}
}
Is there an option to snap one item at a item no matter how fast the user flings?