Gilbert
Gilbert

Reputation: 3304

Connect recyclerview to view pager

I have a recyclerview with pictures. I want to set it up in such a way that when I click the picture I get to see it full screen. Then I can swipe left and right to go to other pictures. Much like how a gallery app works. How can I do this?

Currently I have setup a view pager but whichever item in the recycler view I click I go to the view pager which starts from the first picture in the collection and not the picture I clicked on.

Upvotes: 1

Views: 95

Answers (1)

Muhamed El-Banna
Muhamed El-Banna

Reputation: 617

when you click on image ,, get index of this image and pass it to viewPager to open the same image

viewPager.setCurrentItem(position);

Upvotes: 1

Related Questions