Bagadeshkumar R
11/03/2021, 6:40 AMSteffen Funke
11/03/2021, 7:41 AMLazyColumn(
modifier = Modifier.fillMaxWidth()
) {
var selected by mutableStateOf("")
items(myItems) { item ->
val isSelected = item == selected
ListItem(
modifier = Modifier
.clickable { selected = item }
.offset(x = if (isSelected) 20.dp else 0.dp)
) {
Text(item)
}
}
}
Steffen Funke
11/03/2021, 7:43 AMselected
item somewhere (preferredly in ViewModel) - and then apply an offset
-Modifier to the item, based on wether it is the selected item_._
The offset is not animated here, but that could be added via animateDpAsState
, or the likes.Bagadeshkumar R
11/03/2021, 7:54 AMSteffen Funke
11/03/2021, 8:05 AMLazyColumn
, maybe some of the Compose experts can chime in.
If not, then fake-overlaying the selected item over the list would probably be an option.
Other than that, you would need to make sure what happens if the cell is only half in view (scroll into viewport?).Bagadeshkumar R
11/03/2021, 8:22 AMAdib Faramarzi
11/03/2021, 12:45 PMclipChildren = false
of some sort.Bagadeshkumar R
11/03/2021, 12:55 PMAdam Powell
11/03/2021, 1:38 PMAdam Powell
11/03/2021, 1:39 PMBagadeshkumar R
11/04/2021, 2:56 AMSteffen Funke
11/04/2021, 7:09 AM