Shikha Ratra Shikha Ratra - 5 months ago 57
Android Question

How to center the Clicked position in the Recyclerview

I want to center the clicked position in the

. I am able to scroll the
to certain position but i want to middle that position in the screen.
I used this method to scroll to that position.



if you use linearlayoutManager, you can use this code,

linearLayoutManager.scrollToPositionWithOffset(2, 20);

(linearLayoutManager.void scrollToPositionWithOffset (int position, 
            int offset))

Setting the offset to 0 should align with the top