Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewPager in RecyclerView #110

Open
FarshidABZ opened this issue Jan 21, 2019 · 1 comment
Open

ViewPager in RecyclerView #110

FarshidABZ opened this issue Jan 21, 2019 · 1 comment

Comments

@FarshidABZ
Copy link

I have a recyclerview that each item has a ViewPager. At the first when I scroll ViewPager, indicator works awesome, But when I scroll my list to the 20th item then scroll ViewPager, indicator always shows the first item.

List First Item
firstitem

Last Item
seconditem

@suhotrub
Copy link

suhotrub commented Mar 22, 2019

Hi, FarshidABZ

Problem comes from findViewPager in PageIndicatorView
View view = activity.findViewById(viewPagerId);
All of your ViewPagers inside RecyclerView have the same id.

There is very dirty solution. Change ViewPagers's identical ids to unique inside your ViewHolder programmatically.
viewPager.id = dataId.hashCode()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants