Reputation: 3440
When using the bottom navigation bar with Jetpack Compose version 1.5.4, Material3 1.2.0-rc01 as follows
BottomNavigationItem().bottomNavigationItems().forEachIndexed { _, navigationItem ->
NavigationBarItem(
selected = navigationItem.route == currentDestination?.route,
label = {
Text(navigationItem.label)
},
icon = {
Icon(
navigationItem.icon,
contentDescription = navigationItem.label
)
},
onClick = {
navController.navigate(navigationItem.route) {
popUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
}
)
}
I see it like here (in Moto G - 4.5") when I use a longer text label. Looks ok on Pixel 5.
The label "Top Movies" wraps and pushes the icon above.
I don't think I should use explicit fontSize (like 10.dp which fixes the issue). Is there a better way of handling this across device sizes?
Upvotes: 3
Views: 588
Reputation: 472
I find it strange that the app Home from Google uses Material 3 bottom bar, but when I tried with the same labels and same text size the labels don't fit.
I am trying to configure the Margin between destinations...
Upvotes: 0
Reputation: 923
There is no guarantee that there will be enough space in this case. Things will get worse with the use of multiple languages.
Hope to help you!
Upvotes: 1
Reputation: 930
According to Material Design 3 guidelines, the right thing to do would be to come up with a shorter text label instead, preferably consisting of one word.
Does your app specialize in movies? Would it be appropriate to omit the word "Movies" and label the destination "Top" or "Hot" or "Best" or "Popular"?
Upvotes: 1