This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val options = listOf("Food", "Bill Payment", "Recharges", "Outing", "Other") | |
var expanded by remember { mutableStateOf(false) } | |
var selectedOptionText by remember { mutableStateOf(options[0]) } | |
ExposedDropdownMenuBox( | |
expanded = expanded, | |
onExpandedChange = { | |
expanded = !expanded | |
} | |
) { | |
TextField( | |
readOnly = true, | |
value = selectedOptionText, | |
onValueChange = { }, | |
label = { Text("Categories") }, | |
trailingIcon = { | |
ExposedDropdownMenuDefaults.TrailingIcon( | |
expanded = expanded | |
) | |
}, | |
colors = ExposedDropdownMenuDefaults.textFieldColors() | |
) | |
ExposedDropdownMenu( | |
expanded = expanded, | |
onDismissRequest = { | |
expanded = false | |
} | |
) { | |
options.forEach { selectionOption -> | |
DropdownMenuItem( | |
onClick = { | |
selectedOptionText = selectionOption | |
expanded = false | |
} | |
) { | |
Text(text = selectionOption) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment