I’m working on a `Table` and I’m looking for a bes...
# compose
k
I’m working on a
Table
and I’m looking for a best way to implement “sticky columns”. To be more specific, I would like to have 2 first columns sticky. My current approach is like that (looking form top to bottom):
Copy code
Box(horizontalScroll) -> LazyColumn -> Row -> Box(dynamic-width cell) -> ...
How would you approach sticky column implementation? It would be best if I could tell to
ScrollState
, starting from which pixel scrolling should be enabled, however I guess it’s not possible. Another approach would be to have two instances of
Table
“rowed” and only apply
horizontalScroll
to the one on the right, but it seems like a workaround. Is there a better solution?
m
z
You can use stickyHeader function in your lazyRow and put your sticky columns in it. Note: don't forget to annotate your Composable with @ExperimentalFoundationApi because it is Experimental as of now.
k
Thanks for ideas 🙂