Anders Kielsholm
08/31/2021, 8:25 AMDropdownMenu
and I don't know if it's me doing something wrong. I want the `DropdownMenuItem`s to contain an icon and text. It however seems like the width of the items are based on the text solely and not the combined width. I have this implementation as an example (in the actions
part of a TopAppBar
):
IconButton(onClick = { showMenu = !showMenu }) {
Icon(<http://Icons.Default.Menu|Icons.Default.Menu>, contentDescription = null)
}
DropdownMenu(
expanded = showMenu,
onDismissRequest = { showMenu = false }
) {
DropdownMenuItem(
onClick = { }
) {
Icon(Icons.Default.ThumbUp, contentDescription = null)
Text("This is a line", maxLines = 1)
}
DropdownMenuItem(
onClick = { }
) {
Icon(Icons.Default.Clear, contentDescription = null)
Text("This is another line", maxLines = 1)
}
}
I've attached some Screenshots. The first is how it looks with the above implementation (see the second line is cut off). The second is how it looks without the icons - notice how the width of the box is exactly the same as the first. The third is how I want it to look in the end (I achieved this by setting a static with on one of the `Text`s to 170 dp).
Does anyone know what I'm doing wrong - or could it be a bug?Felix Schütz
08/31/2021, 9:36 AMAnders Kielsholm
08/31/2021, 9:45 AMFelix Schütz
08/31/2021, 9:46 AMAnders Kielsholm
08/31/2021, 10:43 AMAlbert Chang
08/31/2021, 11:00 AMIcon
is zero. Filed an issue: https://issuetracker.google.com/issues/198206454Anders Kielsholm
08/31/2021, 11:03 AMAlbert Chang
08/31/2021, 11:06 AMModifier.size(24.dp)
.Anders Kielsholm
08/31/2021, 2:49 PMShivam Kumar Jha
09/07/2021, 7:54 AM