@Composable fun TextDemo() { Column(modifier = Modifier.fillMaxSize()) { var text by remember { mutableStateOf("Hello, World!") } Button(onClick = { text = "Good" }) { Text(text = "Go") } Text(text) } }
点击button, 修改text
@Composable fun TextDemo() { Column(modifier = Modifier.fillMaxSize()) { var text by remember { mutableStateOf("Hello, World!") } Button(onClick = { text = "Good" }) { Text(text = "Go") } Text(text) } }
点击button, 修改text