Colton Idle
03/25/2021, 5:01 PMColton Idle
03/25/2021, 5:03 PM@Preview
@Composable
fun TextWithSquare() {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.height(IntrinsicSize.Max)
.fillMaxWidth()
.padding(horizontal = 16.dp)
.clickable { }
) {
Text(
"Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. Very long text. ",
maxLines = 1,
modifier = Modifier
.padding(end = 16.dp)
.weight(1f),
overflow = TextOverflow.Ellipsis
)
Box(
Modifier
.background(Color.Blue)
.requiredHeight(24.dp)
.requiredWidth(24.dp),
)
}
}
Colton Idle
03/25/2021, 5:03 PMSe7eN
03/25/2021, 6:13 PMBox
instead of the Text
Colton Idle
03/25/2021, 6:25 PMBryan L
03/25/2021, 8:38 PMRow(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Start,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.clickable { }
) {
Timo Drick
03/26/2021, 10:11 AMRow(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.height(IntrinsicSize.Max)
.width(IntrinsicSize.Max)
//.fillMaxWidth()
.padding(horizontal = 16.dp)
.clickable { }
) {
But not so clean in my opinion. But i do not have a better solution. Maybe some one else?Colton Idle
03/26/2021, 4:24 PMAdam Powell
03/26/2021, 4:27 PM.weight(1f, fill = false)
len
03/26/2021, 4:52 PM.weight(1f)
on the first element
2: Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween)
in the parent
I kind of prefer the second one, however it's taking some of the second item width, while this doesn't happen with the first oneAdam Powell
03/26/2021, 4:59 PMColton Idle
03/26/2021, 5:02 PMlen
03/26/2021, 5:05 PMIconButton
I guess it'd need some minWidth
modifierAdam Powell
03/26/2021, 5:11 PMlen
03/26/2021, 5:13 PMRow(
modifier = Modifier.fillMaxWidth().height(64.dp).padding(start = 16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text("Title")
Text("Subtitle")
}
IconButton()
}
len
03/26/2021, 5:15 PMstyle
and color
) on the texts but no modifierAdam Powell
03/26/2021, 5:32 PMlen
03/26/2021, 5:52 PMAdam Powell
03/26/2021, 5:58 PM