0

Does anybody know how to force the LinearLayoutManager or even GridLayoutManager to act like on the screen? The whole list will be not scrollable, just a reordering the list of items in to columns and rows (constants defined in the code, or calculates depending on WidthxHeight of the device).

enter image description here

My options:

  • I could use LinearLayoutManager, but it doesn't provide any API methods for this kind of customization (probably, or maybe I'm blind)
  • the better approach will be using GridLayoutManager with the combination of method setSpanSizeLookup, but it using for the row and I don't know how many rows
  • I could have in every block (because every row is dynamically creating from the one huge xml layout, where I'm hiding not necessary stuff) maybe I just need to extend the GridLayoutManager and try to figure it out, but it looks like the long distance run and maybe I didn't get the result as I wanted.

The blocks (in this particular case 9 blocks) are not scrollable, not even the whole layout, just a reordering of the rows of this list.

So I'm turning to you, do you have any idea?

jantursky
  • 1,122
  • 1
  • 10
  • 21
  • If it doesn't scroll, there's really no point in using a `RecyclerView` at all. Use a `TableLayout`, a `GridLayout`, etc. – Mike M. Apr 19 '18 at 00:18
  • @MikeM. That will not work, because it should be notified, insert, remove rows etc., which will ensure to reordering the rows and shifting depending on the column size. – jantursky Apr 19 '18 at 06:02
  • Sure it would work. I suspect it'd be easier to write the logic for that in a static layout than it would be to modify one of the pre-defined `LayoutManager`s to do it. – Mike M. Apr 19 '18 at 06:16
  • @MikeM. Maybe yes, but I forgot to mention, that there will be layoutManager switcher of multiple list reordering. – jantursky Apr 19 '18 at 06:58

0 Answers0