0

I have a vertical recyclerview, eatch item of the vertical recyclerview have a horizontal recyclerview, all items of the horizontal recyclerview have diferent withs and the same height, i'm scrolling the recycler programatically with distances in pixels, almost everything works fine.

All the horizontal recyclers must be syncronized, they have to scroll the same distance. I can scroll horizontally in all visible rows, but the horizontal recyclerview are losing the position when i scroll the verticall recycler.

Any ideas?

I'm trying things with the adapter, like the onViewRecycled and other functions of the adapter, but no success yet

xanexpt
  • 663
  • 7
  • 20

1 Answers1

1

In Recycleview adapter you can add below line. It's already working for my code.

public int getItemViewType(int position) {
        return dataSet.get(position).getId();
    }
Hardik Vaghasiya
  • 278
  • 3
  • 11
  • thanks, it work, i used this one instead; @Override public int getItemViewType(int position) { return position; } || now I only need to scroll all the horizontall recycler and keep the scroll amout equal in all of them; – xanexpt Sep 05 '16 at 12:53
  • 1
    Giving each item in your recyclerview a different position will cause a huge hit on performance because the views will no longer be recycled since each view at each position is unique – 11m0 Aug 21 '18 at 16:07