-
Notifications
You must be signed in to change notification settings - Fork 289
Basic drop down menu examples #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Here is the summary of changes. You are about to add 2 region tags.
This comment is generated by snippet-bot.
|
| TopAppBar( | ||
| title = { Text(text = "Basic menu example") }, | ||
| actions = { | ||
| IconButton(onClick = { shouldDisplayMenu = !shouldDisplayMenu }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend adding a second action, thereby making it clearer that the IconButton+DropdownMenu should be wrapped by a Box to correctly set the anchor for the DropdownMenu:
actions = {
IconButton(onClick = { shouldDisplayMenu = !shouldDisplayMenu }) {
Icon(Icons.Default.StarOutline, stringResource( R.string.cd_star))
}
Box {
IconButton(onClick = { shouldDisplayMenu = !shouldDisplayMenu }) {
Icon(Icons.Default.MoreVert, stringResource(R.string.cd_more_options))
}
DropdownMenu(
expanded = shouldDisplayMenu,
onDismissRequest = { shouldDisplayMenu = false }
) {
DropdownMenuItem(
text = { Text("Refresh") },
onClick = { /* Handle refresh! */ }
)
DropdownMenuItem(
text = { Text("Settings") },
onClick = { /* Handle settings! */ }
)
}
}
| title = { Text(text = "Basic menu example") }, | ||
| actions = { | ||
| IconButton(onClick = { shouldDisplayMenu = !shouldDisplayMenu }) { | ||
| Icon(Icons.Default.MoreVert, "Overflow menu button") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content description should describe the action. Change to "More options".
| modifier = Modifier.fillMaxWidth(), | ||
| label = { Text("Select an option") }, | ||
| trailingIcon = { | ||
| IconButton(onClick = { expanded = true }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want the whole text field to be clickable, not just the arrow?
No description provided.