Join Slack
Hi. I am trying to get this layout
# compose
l
Luka
07/22/2021, 9:06 AM
Hi. I am trying to get this layout
Luka
07/22/2021, 9:06 AM
@Composable fun TodayRow(amount: String) { Row( verticalAlignment = Alignment.CenterVertically, modifier = Modifier .background(colorResource(id =
R.color.bg
_creamy)) .height(dimensionResource(id = R.dimen.list_item_height_normal)) ) { Divider( color = colorResource(id = R.color.dark_mode_black_2), modifier = Modifier .width(14.dp) ) Text( text = stringResource(id = R.string.today), fontWeight = FontWeight.Medium, color = colorResource(id = R.color.dark_mode_black_2), fontSize = 13.sp, modifier = Modifier .padding(start = 2.dp, end = 2.dp) ) Divider( color = colorResource(id = R.color.dark_mode_black_2), modifier = Modifier .padding(end = 2.dp) ) Text( text = amount, fontWeight = FontWeight.Medium, color = colorResource(id = R.color.dark_mode_black_2), fontSize = 13.sp, modifier = Modifier .padding(end = 2.dp) ) Divider( color = colorResource(id = R.color.dark_mode_black_2), modifier = Modifier .width(14.dp) ) } }
Luka
07/22/2021, 9:07 AM
What i get is this:
Luka
07/22/2021, 9:07 AM
Any idea what i am missing?
a
alorma
07/22/2021, 9:07 AM
maybe you should set the middle divider with
Modifier.weight(1f)
l
Luka
07/22/2021, 9:23 AM
I removed end padding from the second divider and added Modifier.weight(1f) to it and now it works.
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by