Hey, I'm having some trouble finding a way to control the selection state of an item in a
LazyColumn
. Anyone knows how to do this? What I'm trying to achieve is getting to the selected state on a click (not a long click).
t
Tash
03/28/2021, 5:41 PM
You can maintain a selected: Boolean state per item that updates upon
onClick
of a
Button
or
Modifier.clickable
. If you don't allow multi selection, then you also need to keep some state at the level of the whole list itself.
t
Tymmm1
03/28/2021, 6:49 PM
@Tash thank you but my question is more about how to make the item adhere to that state. I guess I could always just change the background color manually but that seems wrong.