Closed JasonHezz closed 6 years ago
I believe this is the behavior of the default LinearSnapHelper. Something similar can be observed in the epoxy sample app.
Given that this snap helper is the standard behavior provided by google I didn't look into it too much yet, but it would be a good thing to investigate.
In the meantime can set your own default snap helper to change the snapping behavior, or set it to no snap helper.
Carousel.setDefaultGlobalSnapHelperFactory(null to disable or a custom value if you want)
I'm considering using a library such as https://github.com/rubensousa/RecyclerViewSnap as the default, but I want to be a little careful about including other libraries.
Thanks, it works , but why SnapHelperFactory is abstract static class
This sort of explains this problem with LinearSnapHelper
https://github.com/rubensousa/RecyclerViewSnap
I used the above mentioned library in the onBind callback, and set the global default to null
. (else it will start to dance between the 2 snapping strategies)
Carousel.setDefaultGlobalSnapHelperFactory(null)
carousel {
id("some_id")
numViewsToShowOnScreen(2.2f)
models(listOfModels)
onBind{ _, recyclerView, _ ->
GravitySnapHelper(Gravity.START)
.attachToRecyclerView(recyclerView)
}
}
numViewsToShowOnScreen(2.2f)
Mine is still dancing... I'm confuse
I forgot to add this Carousel.setDefaultGlobalSnapHelperFactory(null)
and mine were dancing left and right.
The above solution works.
sample link
step to reduce:
carousel will have a bounce when reach first position and auto scroll a offset happened in lands landscape