4

I have got a recycler view that shows a list of images. I have added an onScrollListener to that recycler view.

Now, when a scroll is detected, I would like to set the translation of the imageviews in the viewholders. Therefore I need a reference to the underlying view holders.

How can I get those?

In code (this won't work, but you will get the idea what I want to achieve):

ImageView imageView = (ImageView) ((RecyclerFragmentAdapter.MyViewHolder) 
    mRecyclerView.getChildAt(i)).itemView.findViewById(R.id.imageView);
// ... Modify imageview, i.e. imageView.setImageMatrix(customImageMatrix);
user2426316
  • 7,131
  • 20
  • 52
  • 83
  • What exactly are you trying to do? Would `ItemAnimator`s work? https://github.com/wasabeef/recyclerview-animators – tachyonflux Jul 04 '15 at 17:31

1 Answers1

6
RecyclerView.getChildViewHolder()
RecyclerView.findViewHolderForAdapterPosition()
RecyclerView.findViewHolderForLayoutPosition()
Neil
  • 664
  • 6
  • 16