I am using a RecyclerView to display items horizontally.
I want that when i use scrollToPosition(position), the respective item appears on the center not on the left.
Does anyone has any idea how to do it? I know how to do it using smoothScrollToPosition, but in this case i need to do it with scrollToPosition.
Consider using scrollToPositionWithOffset(int position, int offset)
and passing required offset as you wish from left. You can find your required offset by using the width of the parent layout (assuming you are using horizontal recycler view). cheers :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With