Is there any solution how to implement Horizontal recyclerview with the combination of vertical recyclerview that is inside every column of this horizontal list? Something very similar like in Android Trello app (red arrows - slide for the whole list, brown arrow - slide in every list separately). I'm trying to focus on the performance of the app, so no predrawing of the recyclerview for every column, there should probably work recycling of not-seeing rows in every column recyclerview as much as for the whole horizontal recyclerview.
Asked
Active
Viewed 278 times
1
-
just a guess, they are using one RecyclerView in a ViewPager with margins. the ViewPager is using SnapHelper – Zun Apr 13 '18 at 13:38
-
@ZUNJAE Not really, because I already checked their source codes, and there is another logic. – jantursky Apr 13 '18 at 14:13
-
so why do you not want to use a recyclerview in a viewpager? – Zun Apr 13 '18 at 14:15
-
@ZUNJAE Because of **performance**, with every fragment instancethe recyclerview in every fragment will be initiated - many memory consumption, so I'm looking for more optimal solution – jantursky Apr 13 '18 at 14:20
-
Do you get a solve for this? – JavierSegoviaCordoba Jun 23 '18 at 01:22
-
@Dahnark Check the answer. – jantursky Jun 23 '18 at 11:44
2 Answers
1
I tried a couple of solutions/combinations, but the best solution for me was using this logic:
- initialization - AsyncLayoutInflater asyncInflater, LayoutInflater inflater
- calculate width and height of view
- calculate width and height of single block, should be the same sizes for every block
- using blocking variable for case of redrawing during drawing
- async inflate of the view
- prepare data in the inflater listener
- async again if there is left some space for the block
- store the view in the array, store the data
- loop and inflate again, until all the spaces will be occupied
- draw the data
Maybe the logic looks kinda hard, but it was the beeter and I'got really good handling for later cases. I know, that I could use also multiple RecyclerView splitted into blocks, but it was much more difficult to listen for changes and handle them.

jantursky
- 1,122
- 1
- 10
- 21