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.
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,
matchParentsetsalignSelftostretchand as such, the view will not be centered.The current work around is to set width to
100.percentinstead ofmatchParent.