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 ?modifier.weight(0.8).background(color)
Column(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)) {
}
}
}
val 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 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)) {
}
}
}
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)) {
}
}
}
Adam 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)) {
}
}
}
}
Component(modifier = Modifier.size(100.dp))