Hello. I am using the `BottomNavigationItem` alon...
# compose
n
Hello. I am using the
BottomNavigationItem
along with
BottomNavigation
for my nav bar. My text is getting wrapped as shown. I tried playing around with
Text(softWrap = false, maxLines = 1)
but that approach just doesn't show the text that cannot be fit. The only option that works is making the
fontSize
lower but that i would like to avoid due to user experience. Is there any way to solve this problem other than having to build my own custom
Row, Column
solution? (I will add an icon on top of text later)
Maybe something like removing some padding that gets automatically applied? However this parameter is private and not exposed.
s
Well the text needs to go somewhere, where will it go? And to your answer about a custom implementation, yeah if you want a bar which doesn't follow the material3 specs you need to copy the code and adjust it yourself.
m
You can always take away the padding constraint using `Modifier.layout`:
Copy code
Text(
    "Dashboard",
    modifier = Modifier.layout { measurable, constraints ->
        val placeable = measurable.measure(constraints.copy(maxWidth = constraints.maxWidth + 24.dp.roundToPx()))
        layout(placeable.width, placeable.height) {
            placeable.place(0, 0)
        }
    },
)
­čĹÇ 1