Nikola Milovic
05/31/2020, 8:23 AMDavid Miguel
05/31/2020, 10:02 AMNikola Milovic
06/02/2020, 9:21 AMDavid Miguel
06/02/2020, 9:33 AMHeaderAdapter
can inflate another horizontal recycler viewNikola Milovic
06/02/2020, 10:00 AMzhuinden
06/02/2020, 1:58 PM1
item of a horizontal recycler view, and the other displays n
items of the vertical list. Then put the two adapters in a MergeAdapter, now you don't even need to worry about item view types. That's what's thrown people off for almost a decade.Nikola Milovic
06/02/2020, 4:49 PMzhuinden
06/02/2020, 5:12 PMNikola Milovic
06/02/2020, 5:42 PMzhuinden
06/02/2020, 5:44 PMNikola Milovic
06/02/2020, 5:46 PMzhuinden
06/04/2020, 7:37 PMAnd how would I keep track of this recycleview and use it to attach other items of the first adapter. sorry for bothering you, but this is a breakthrough for menow that is a bit tricky question indeed, but you should not overthink it: you just have to get the data into the adapter of the horizontal recycler view. You have only 1 horizontal recyclerview, so that should be easy. I had to implement a vertical RecyclerView where each item had a RecyclerView, and I had to track in a
Map<String, LiveData<List<T>>
which item to show in which row, and manage the observers in onAttachedToRecyclerView
, onDetachedFromRecyclerView
(i think that's what it's called) and onBindViewHolder
. That was tough, but it worked reliably in the end.Nikola Milovic
06/04/2020, 8:27 PM