Hi I am exploring recycler view of android.I want to inflate a fragment inside the each item of recycler view.I want to change the layout of item in recycler view by clicking on item.Any Ideas on how to approach this problem
Asked
Active
Viewed 2,225 times
1
-
sonuds like a problem for sure! what is the scenario where you would want to do this? sounds like it goes against alot of conventions and norms – apelsoczi Jun 07 '16 at 18:34
-
Why are you trying to inflate a fragment instead of a view? – Darussian Jun 07 '16 at 19:19
-
What I am trying to do is change the layout of the item in recycle view on clicking on it – bhavirisetty pavan Jun 07 '16 at 20:03
-
I had problem that fragment displayed only for the first item. I solved the problem by setting new unique id for container layout before adding fragment. This answer helped me. https://stackoverflow.com/a/42994810/1931613. For example, myContainerLayout.setId(SystemClock.currentThreadTimeMillis().toInt()) – Kiryl Ivanou Sep 06 '19 at 14:15
1 Answers
1
hmm... recyclerview is not for that, is it for recycle views ^^, if you want to dislpays fragments in a 'list' you can create a class extending LinearLayout which will display your fragments.

abdoulayeYATERA
- 209
- 1
- 2
-
What I am trying to do is change the layout of the item in recycle view on clicking on item. – bhavirisetty pavan Jun 07 '16 at 20:00
-
ok i see, can't you update your adapter when you receive the click event and then, notify the adapter the data set change to update the ui ? i hope you will find a solution. – abdoulayeYATERA Jun 09 '16 at 08:45