Justin Xu
02/07/2023, 3:34 AMRow(
verticalAlignment = <http://Alignment.Top|Alignment.Top>,
modifier = Modifier
.height(IntrinsicSize.Min)
) {
Text(
text = dollarSign, // $
fontSize = fontSize.times(0.6)
)
Text(
text = moneyAmount, // 89
fontSize = fontSize
)
}
That should show a small dollar sign before the money amount. However, the dollar sign is not aligned with the top of the money amount, and I can't figure out why. There's a screenshot below with a gray background on the Row composable to illustrateOleksandr Balan
02/07/2023, 8:02 AMText
and set a baselineShift
for the dollar sign.
val fontSize = 64.sp
Text(
text = buildAnnotatedString {
withStyle(
SpanStyle(
fontSize = fontSize.times(0.6f),
baselineShift = BaselineShift(0.25f),
)
) {
append("$")
}
append("89.00")
},
fontSize = fontSize,
)
It is a bit guessing game with that “0.25” value, but at least it should be consistent with font size.Tung97 Hl
02/07/2023, 5:20 PM