-
Notifications
You must be signed in to change notification settings - Fork 149
How to use another LayoutManager for sections? #99
Comments
I've already tried to use setSpanCount for the section objetcs, but nothing happens. Also, tried to override getSpanSize, but this does not make a difference too :/ |
Hi, GridLayoutManager supports only the column count (span) and doesn't consider the row count. Even StaggeredGridLayoutManager will not help in this case. You need to build your own layout manager. You can take look here for some inspiration - https://lucasr.org/2014/07/31/the-new-twowayview/ As far as the library is concerned, span concept is based upon the default layout managers. But if you create/use a custom layout manager, you can extend the library classes and use it. |
Actually, my question was: can I, somehow, use a LayoutManager for sections and a different one for ListSections? If so, that would solve my problem, I could use LinearLayoutManager or GridLayoutManager for sections and SpannedGridLayoutManager for section items! |
Thanks for clarifying. LayoutManagers are set to the recyclerview. So unfortunately, this library doesn't support the use case of multiple layout managers. |
Oh, that's a shame :/ But thank you very much anyway, that's a great library! |
I currently have an app that has a custom layout for the headers, and I need to use SpannedGridLayoutManager to replicate the Instagram Search Page behavior: 1x1 size for picutre items, 2x2 for video ones.
How can I achieve that?
Here is a print of how the screen is looking like:
In the header layout, there is no space under the green date badge, it is height fixed by the SpannedGridLayoutManager. I've already tried very hard to change this height in the viewHolder implementation, but no success. When I use GridLayoutManager, as in the sample, works fine, but the views are not organized:
The text was updated successfully, but these errors were encountered: