https://kotlinlang.org logo
#compose
Title
# compose
k

KamilH

09/26/2022, 8:29 PM
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

MR3Y

09/26/2022, 8:55 PM
z

Zaki Shaikh

09/27/2022, 4:21 AM
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

KamilH

09/27/2022, 6:04 AM
Thanks for ideas 🙂
3 Views