Код: Выделить всё
@Composable
private fun Actions() {
Row {
// More
var showMore by rememberState(initial = false)
IconButton(onClick = {showMore = true} )
{
Icon(imageVector = Icons.Outlined.MoreVert, contentDescription = null)
DropdownMenu(expanded = showMore, onDismissRequest = { showMore = false }
) {
Column {
Composable1
Composable2
Composable3
Composable4
}
}
}
}
}
Код: Выделить всё
What i need is changing the value of the variable showMore to "false" when the user clicks on one of the Composable in the column. I also tried putting the variable in a viewModel, so to change its value when the user is in the Composable, with a similar code (obviously changing the previous code so to collect the state of the variable from the view model and change it with the two functions):
Код: Выделить всё
var showMenuMore by mutableStateOf(false)
private set
fun showMenuMoreOpen() {
showMenuMore = true
}
fun showMenuMoreClose() {
showMenuMore = false
}
Спасибо за помощь.
Подробнее здесь: https://stackoverflow.com/questions/790 ... composable