loloof64
11/24/2020, 5:01 PM@Composable
fun MyComposable(modifier: Mofifier) {
Column(modifier = modifier.background(backgroundColor)) {
(0 until 8).forEach { row ->
val color = if (row%2 == 0) whiteCellColor else blackCellColor
Row(modifier = Modifier.size(10.dp).background(color)) { // Here how to get a ration of 0.111 of the Composable size rather than a fixed 10dp Size ?
}
}
}
}
How can make the size(10.dp)
(see the comment) be a ratio of the parent instead ?loloof64
11/24/2020, 5:04 PMmodifier.weight(0.8).background(color)
loloof64
11/24/2020, 5:13 PMloloof64
11/24/2020, 5:13 PMColumn(modifier = modifier.background(backgroundColor)) {
(0 until 8).forEach { row ->
val color = if (row%2 == 0) whiteCellColor else blackCellColor
Row(modifier = modifier.weight(1f).background(color)) {
}
}
}
loloof64
11/24/2020, 5:14 PMval backgroundColor = Color(0xCAD63B60)
val whiteCellColor = Color(0xFFFFCE9E)
val blackCellColor = Color(0xFFD18B47)
Adam Powell
11/24/2020, 5:22 PMModifier.fillMax[Width|Height|Size](0.111f)
?loloof64
11/24/2020, 5:25 PMloloof64
11/24/2020, 5:31 PMColumn(modifier = modifier.background(backgroundColor)) {
(0 until 8).forEach { row ->
val color = if (row%2 == 0) whiteCellColor else blackCellColor
Row(modifier = Modifier.fillMaxHeight(0.1f).background(color)) {
}
}
}
loloof64
11/24/2020, 5:32 PMColumn(modifier = modifier.background(backgroundColor)) {
(0 until 8).forEach { row ->
val color = if (row%2 == 0) whiteCellColor else blackCellColor
Row(modifier = modifier.fillMaxHeight(0.1f).background(color)) {
}
}
}
loloof64
11/24/2020, 5:32 PMAdam Powell
11/24/2020, 5:33 PMloloof64
11/24/2020, 5:44 PM@Composable
fun Component() {
Column(modifier = modifier.background(backgroundColor)) {
(0 until 8).forEach { row ->
val color = if (row%2 == 0) whiteCellColor else blackCellColor
Row(modifier = Modifier.fillMaxHeight(0.1f).background(color)) {
}
}
}
}
loloof64
11/24/2020, 5:45 PMComponent(modifier = Modifier.size(100.dp))