Hi folks! I need to set priority (content resistan...
# compose
y
Hi folks! I need to set priority (content resistance) to item in
Row
but cannot figure out how to do it. For sample I have few texts in Row, but I need truncate the first one for sample, not the last
weight
isn’t correct way to do it Thanks
a
are you avoiding weight because you don't want it to fill the full available space or for some other reason?
y
weight don’t do it as I need. At least for text.
a
how so? I ask because people don't always find the
fill
optional parameter to
weight
, and setting it to
false
avoids filling the whole space but it does lower the element's measurement priority so that other siblings measure first.
🙌 1
y
Copy code
Row(
    modifier = Modifier.fillMaxWidth(),
    horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
    Text(
        text = walletName,
        style = MaterialTheme.typography.body1,
        maxLines = 1,
        overflow = TextOverflow.Ellipsis,
    )
    Text(
        text = amount,
        modifier = Modifier
            .weight(1f, fill = true),
        style = FormularMonoTypography.body2,
        maxLines = 1,
    )
}
May be I wrong but it’s not as priority.
a
set weight on the lower priority item - the
walletName
text.
y
+
from amount - only first symbol
a
unweighted children measure first
y
Yep. It need to truncated walletName if space not enough
So you offer to put
Copy code
Modifier.weight(1f, fill = false)
on the walletName?
👍 1
Let me check
@Adam Powell Thanks a lot. It help. You right. I didn’t consider
fill = false
yearly
👍 1