Nthily
07/19/2023, 1:29 PMLazyColumn
while keeping the current position
e.g : when the list changes from (1,2,3,4,5) to (10,9,8,7,1,2,3,4,5), the first visible item remains 1?Timo Drick
07/19/2023, 1:47 PMNthily
07/19/2023, 1:48 PMTimo Drick
07/19/2023, 1:50 PMTimo Drick
07/19/2023, 2:00 PMTimo Drick
07/19/2023, 2:01 PMLazyColumn {
items(list, key = { it }) { item ->
Text(item)
}
}
Of course you need unique id for every itemTimo Drick
07/19/2023, 2:05 PMNthily
07/19/2023, 2:31 PMitems {
key(it.id) { ...// content }
}
I'm not sure where I saw this syntax as equivalent to your previous code, but I just tested it and they are completely different.Stylianos Gakis
07/19/2023, 2:41 PMkey() {}
is there for situations where you’re not in a lazy list. it serves it’s purpose for other such scenarios. But when you’re in a lazy list you want to use the key in the items dsl indeed