Nat Strangerweather
04/25/2021, 4:49 PM.fillMaxWidth
modifier. In that box, I have another box and I want it to be the width of the parent box divided by 7. How can I get the width of the parent Box, or that .fillMaxWidth
value?nitrog42
04/25/2021, 4:52 PMBox {
Box(Modifier.fillMaxWidth(1/7f)) {
}
}
Nat Strangerweather
04/25/2021, 4:53 PMnitrog42
04/25/2021, 4:54 PMNat Strangerweather
04/25/2021, 4:58 PMBox(
modifier = Modifier
.fillMaxWidth()
.height(500.dp)
.padding(20.dp)
.background(Color.DarkGray)
) {
Column() {
repeat(7){
Box(
Modifier
.padding(3.dp)
.background(Color.Magenta, shape = RoundedCornerShape(5.dp))) {
}
Nat Strangerweather
04/25/2021, 4:59 PMnitrog42
04/25/2021, 5:01 PMnitrog42
04/25/2021, 5:02 PMnitrog42
04/25/2021, 5:02 PMnitrog42
04/25/2021, 5:03 PMNat Strangerweather
04/25/2021, 5:04 PMnitrog42
04/25/2021, 5:04 PMNat Strangerweather
04/25/2021, 5:05 PMnitrog42
04/25/2021, 5:05 PMnitrog42
04/25/2021, 5:07 PMBox(
modifier = Modifier
.fillMaxWidth()
.height(500.dp)
.padding(20.dp)
.background(Color.DarkGray)
) {
Column {
repeat(7) {
Box(
Modifier
.padding(3.dp)
.height(50.dp)
.fillMaxWidth(1/7f)
.background(Color.Magenta, shape = RoundedCornerShape(5.dp))
) {
}
}
}
}
this should worknitrog42
04/25/2021, 5:08 PM.background(Color.Magenta, shape = RoundedCornerShape(5.dp))
your child boxes won't be displayed as you need to fix the height of each of them, or put content in it (text, image)Nat Strangerweather
04/25/2021, 5:10 PMnitrog42
04/25/2021, 5:11 PMBox(
Modifier
.padding(3.dp)
.fillMaxWidth(1 / 7f)
.aspectRatio(1f)
Nat Strangerweather
04/25/2021, 5:11 PMnitrog42
04/25/2021, 5:12 PMNat Strangerweather
04/25/2021, 5:12 PMMaxUt
07/22/2021, 5:05 PM