RecyclerView Auto Scrolling with GravitySnapHelper
c0d3sling3r opened this issue · 11 comments
I found out the problem. Because the recyclerview has a setReverseLayout(true)
this happens.
Thanks for the report. I'll try to find a workaround.
Can you check version 1.5 please? It should be fixed now.
hi, i still have this problem, maybe im not using it in the correct way,
i instance the class as:
val SnapHelper = GravitySnapHelper(Gravity.END)
(its kotlin)
then i set layout-manager as:
layoutManager =
GridLayoutManager(context, 1, RecyclerView.HORIZONTAL, true)
is that correct for RTL horizontal scroll?
@SetareMaghari are you using 1.5? This issue was fixed on 1.5.
If you only have a span count of 1, you should use a LinearLayoutManager instead. But it should work anyway.
@rubensousa yes a use 1.5.
i changed it to linearlayout manager but i still have the problem...
also if i change it to ltr direction there is still the problem!
look at here:
its my code:
recycler.layoutManager =
LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
val SnapHelper = GravitySnapHelper(Gravity.START)
SnapHelper.attachToRecyclerView(recycler)
and the result:(it jumps to the first!)
also the same problem for RTL...
@rubensousa can you help me to solve it?
I can't reproduce this anymore on 1.5. Can you build a sample project and try to reproduce this? If so, please send it to me afterwards.
Closing due to inactivity
just use
val snapHelper = GravitySnapHelper(if (recyclerView.layoutDirection != Gravity.END) Gravity.START else Gravity.END)