I am trying to do this using recycler view with gridlayoutmanager. GridLayoutmanager takes spancount. Here I want to update the view based on the width of the text in the recycler view items.
Asked
Active
Viewed 2,873 times
8
-
Namaste ! :-) I believe you are looking for this http://stackoverflow.com/questions/26666143/recyclerview-gridlayoutmanager-how-to-auto-detect-span-count – Nabin Nov 09 '16 at 04:46
-
Also see this StaggeredGridLayoutManager https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.html – Nabin Nov 14 '16 at 10:40
-
did you solve it? – has19 Nov 26 '18 at 20:00
-
Has this been solved in a native way without any libraries ? – DRayen Sep 30 '20 at 11:21
1 Answers
5
It's a late answer but I wanted to achieve exactly the same stuff!
Then after several hours of research, I found this lib (I don't know why I didn't find it earlier...) by Google: FlexboxLayout who has a FlexboxLayoutManager
!
How to use:
val layoutManager = FlexboxLayoutManager(context)
layoutManager.flexDirection = FlexDirection.ROW
myRecyclerView.layoutManager = layoutManager
That's all!

Itoun
- 3,713
- 5
- 27
- 47