Epoxy: carousel cann't scroll to first position after scrolled once

Created on 20 Oct 2017  路  5Comments  路  Source: airbnb/epoxy

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

Most helpful comment

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)

All 5 comments

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

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)
    }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

fredo- picture fredo-  路  4Comments

aliab picture aliab  路  3Comments

carlosmuvi picture carlosmuvi  路  3Comments

thanapongp picture thanapongp  路  6Comments

ailuoyi picture ailuoyi  路  5Comments