Hey Guys, I am trying to place N LazyColumns in a ...
# compose-android
a
Hey Guys, I am trying to place N LazyColumns in a row to create a table structure and I want a common vertical scroll instead of individual scroll for every LazyColumn. Has anyone achieved a common scroll for two or more LazyColumns? I tried implementing it by observing firstVisibleItemIndex and firstVisibleItemScrollOffset and then scroll the other columns. It is working but not so good. It is completely glitchy and there is a definite lag in scroll of other columns. Let me know of you have worked or seen something like this. Thanks.
c
Is there a reason you are not using LazyGrids for this?
a
I am trying to achieve a table which can scroll both horizontally and vertically. Also, I want to drag and drop an entire column in the table.
👍🏽 1
c
I think you need a custom layout for this. Also, it looks like Compose might be getting something similar to what you are looking for: https://android-review.googlesource.com/c/platform/frameworks/support/+/3636525
👍 1
o
Yes, you will need to build a custom
LazyLayout
. I have done something similar here: • https://github.com/oleksandrbalan/lazytable The
LazyTable
composable uses
LazyLayout
to achieve 2D lazy loading and allows a 2D scrolling in the table. There is also a perfect article about
LazyLayout
here, if you want to build it yourself: • https://www.ackee.agency/blog/custom-lazylayout-with-jetpack-compose
a
Thanks @Oleksandr Balan. I will check them.
👍 1