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.
4
-
Namaste ! :-) I believe you are looking for this stackoverflow.com/questions/26666143/…Nabin– Nabin2016-11-09 04:46:48 +00:00Commented Nov 9, 2016 at 4:46
-
Also see this StaggeredGridLayoutManager developer.android.com/reference/android/support/v7/widget/…Nabin– Nabin2016-11-14 10:40:11 +00:00Commented Nov 14, 2016 at 10:40
-
did you solve it?has19– has192018-11-26 20:00:09 +00:00Commented Nov 26, 2018 at 20:00
-
Has this been solved in a native way without any libraries ?DRayen– DRayen2020-09-30 11:21:10 +00:00Commented Sep 30, 2020 at 11:21
Add a comment
|
1 Answer
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!
