How to center a recyclerview (horizontal) item horizontally on the screen?

Asked

Viewed 101 times

1

What I want is the following result:

Whenever the user moves to the next or previous item, it will be centered on the screen, just as it works if I use Carousel. I tried some libs from Carousel only that they only allowed adding text/images, and I need to put a layout inside with some editTexts and Buttons that will later be recovered their respective values.

1 answer

0

If you are using buttons to manage navigation you can use this command:

recyclerView.scrollToPosition(position);

which will center in the Recycler view the position passed in the constructor.

I hope it helps.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.