

実装
@Composable
private fun MySwitchView() {
var switchState by remember { mutableStateOf(false) }
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = if (switchState) "Switch is ON" else "Switch is OFF")
Spacer(modifier = Modifier.height(12.dp))
Switch(
checked = switchState,
onCheckedChange = { switchState = it }
)
}
}