I have a MainActivity that contains a Box with a n...
# compose
c
I have a MainActivity that contains a Box with a navhost that's set to fillMaxSize and my bottomNavBar aligned to the bottom. My bottomNavBar is transparent and my content draws under it. It looks cool (like how my designers want), but now my content doesn't know how much padding to add under it so that the bottom piece doesn't get cut off. If I hardcode a height, it works fine, but is there some way to get the height of bottomNav in my navHost even though they are laid out on top of each other in a box?
👀 1
I do see
Copy code
private val BottomNavigationHeight = 56.dp
but its private so I can't access it.
a
Use
Scaffold
and you can get the height from the
PaddingValues
in the
content
lambda.
👍 1
c
@Albert Chang are you recommending to not use a Box as my root, but instead use Scaffold?
a
Yep.
If you don't want to use Scaffold you can also check its source to see how to implement that.
☝️ 1
c
Scaffold will allow the content to draw beneath the bottomNav? Trying to achieve this affect (with a gradient bottom nav background)