Solvedepoxy carousel cann't scroll to first position after scrolled once

sample link

step to reduce:

  • run app
  • scroll right
  • scroll left

carousel will have a bounce when reach first position and auto scroll a offset happened in lands landscape

8 Answers

✔️Accepted Answer

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)

Other Answers:

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)
    }
}

Related Issues:

7
epoxy carousel cann't scroll to first position after scrolled once
I believe this is the behavior of the default LinearSnapHelper Something similar can be observed in ...
3
epoxy EpoxyModelClass subclasses are not generating
@juicycleff if you are using kotlin you need to use kapt instead of annotationProcessor ...