Zeming
03/29/2025, 4:57 AMclass ComposeTestActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
LazyColumn(Modifier.background(Color.White)) {
item { MyMutableText() }
item { MyText() }
}
}
}
}
@Composable
fun MyMutableText() {
var count by remember { mutableIntStateOf(10) }
LaunchedEffect(count) {
delay(2000L)
count++
}
Text("Now Number is: $count")
}
@Composable
fun MyText() {
Text("Demo")
}
romainguy
03/29/2025, 5:19 AMromainguy
03/29/2025, 5:21 AMZeming
03/29/2025, 5:25 AMromainguy
03/29/2025, 5:25 AMZeming
03/29/2025, 5:32 AMChrimaeon
03/29/2025, 8:51 AMZeming
03/29/2025, 9:03 AMChrimaeon
03/29/2025, 9:13 AMWe are also usually optimizing for the case of scrolling lazy layouts that take the whole screen, and everything has to be redrawn anyways with such layout.
marlonlom
03/29/2025, 11:02 AMChrimaeon
03/29/2025, 12:00 PMZeming
03/30/2025, 4:24 AM