0


I was going through this thread on this topic : RecyclerView Animation on Item Click

But I have one question on the technique used. I tried implementing it based on solution above. Although the approach seems to work in the current view of my recyclerview. But as soon as i scroll further to Right (in my case its a Horizontal Recyclerview), i still see the view being expanded since the views are being recycled and the isExpanded value is still true for them. I was thinking shouldn't the isExpanded property be at the data being displayed, so that we don't keep the same state of the reused view ?

Curious to know, how does RecyclerView behaves when you scroll it to the next page.

Thanks,

Community
  • 1
  • 1
duskandawn
  • 646
  • 1
  • 10
  • 19

1 Answers1

0

Ok, basically you need to check each item "state" and prepare the recycled viewholder for the new item to bind.

Please have a look at my ExampleAdapter (in onBindViewHolder()) in my FlexibleAdapter, where you can also find basic click and long click listener already implemented as example.

Feel free to ask questions.

Recently I've improved and created a FlexibleAdapter pattern for all RecyclerView. Very simple to use, just copy 2 classes in your common files + some xml in order to enable the selection (Single/Multi) as it was for ListView.

Please have a look at the description and full working example: https://github.com/davideas/FlexibleAdapter

Davideas
  • 3,226
  • 2
  • 33
  • 51