https://kotlinlang.org logo
#compose
Title
# compose
d

dagomni

04/06/2020, 6:45 AM
I'm using ConstraintLayout. Can anyone tell me if I need to specifically set the width of BottomNavigation or is there a way to make it fill the parent (Modifier.fillMaxWidth() does nothing)? Edit: performMeasure in ConstraintLayout.Measurer does this
Copy code
state.width(if (constraints.hasBoundedWidth) {
    Dimension.Fixed(constraints.maxWidth.value)
} else {
    Dimension.Wrap()
})
I'm guessing it would have to call Dimension.spread() in order for it to work in my case or am I wrong?
m

maciejciemiega

04/06/2020, 7:00 AM
I haven’t played with ConstraintLayout yet, but it looks like you need to set something like
bottomNavigation constrainHorizontallyTo parent
inside a
ConstraintSet
d

dagomni

04/06/2020, 7:03 AM
@maciejciemiega My constraints are all set
Copy code
val constraintSet = ConstraintSet {
            val bottomNavTag = tag(bottomNav)
            val viewsContainerTag = tag(viewsContainer)

            <http://viewsContainerTag.top|viewsContainerTag.top> constrainTo <http://parent.top|parent.top>
            viewsContainerTag.bottom constrainTo <http://bottomNavTag.top|bottomNavTag.top>
            viewsContainerTag constrainHorizontallyTo parent

            bottomNavTag.bottom constrainTo parent.bottom
            bottomNavTag constrainHorizontallyTo parent

        }
m

maciejciemiega

04/06/2020, 7:05 AM
then 🤷‍♂️ 😞
😢 1
d

dagomni

04/06/2020, 8:29 AM
Oh yeah, that would make sense, I guess I have to wait for dev09 😅 Thanks for finding it!
m

Mihai Popa

04/06/2020, 11:02 AM
Yep, setting dimensions is not possible in dev08, but should come in the next release 🙂
❤️ 1