Jetpack Compose

@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

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注