Kunafa icon indicating copy to clipboard operation
Kunafa copied to clipboard

BUG: width: matchParent with maxWidth with does not allow the view to be centered.

Open Kabbura opened this issue 6 years ago • 0 comments

Given

        horizontalLayout {
            style {
                height = 400.px
                width = 400.px
                justifyContent = JustifyContent.Center
            }

            verticalLayout {
                style {
                    width = matchParent
                    maxWidth = 280.px
                    height = 200.px
                    backgroundColor = Color.red
                }
            }
        }

The expected behavior is for the child view to be centered vertically inside the parent view. However, matchParent sets alignSelf to stretch and as such, the view will not be centered. The current work around is to set width to 100.percent instead of matchParent.

Kabbura avatar Mar 19 '19 09:03 Kabbura