Arkadii Ivanov
03/04/2021, 9:48 PMBox
vertically, if the height of the Box
is smaller than the height of the content? Currently it sticks to the top and is clipped at the bottom. But I want the content to be centered and clipped from top and bottom.Piotr Prus
03/04/2021, 10:20 PM@Preview
@Composable
fun TestBox() {
Box(
modifier = Modifier
.size(40.dp)
.background(Color.White),
contentAlignment = Alignment.Center
) {
Box(modifier = Modifier.width(20.dp).height(100.dp).background(Color.Red))
}
}
Arkadii Ivanov
03/04/2021, 10:26 PMBox(
modifier = Modifier
.size(48.dp)
.background(Color.LightGray),
contentAlignment = Alignment.Center
) {
Text(text = "X", fontSize = 64.sp)
}
Arkadii Ivanov
03/04/2021, 10:35 PMrequiredHeight
fixes the issue. Thanks!