buildAnnotatedString 関数が用意されている。
Text(
text = buildAnnotatedString {
append("By clicking blow you agree to our ")
withStyle(style = SpanStyle(textDecoration = TextDecoration.Underline)) {
append("Terms of Use")
}
append(" and consent \nto our ")
withStyle(style = SpanStyle(textDecoration = TextDecoration.Underline)) {
append("Privacy Policy")
}
append(".")
},
)
SpanStyle か
ParagraphStyle を指定する。
class SpanStyle(
val color: Color = Color.Unspecified,
val fontSize: TextUnit = TextUnit.Unspecified,
val fontWeight: FontWeight? = null,
val fontStyle: FontStyle? = null,
val fontSynthesis: FontSynthesis? = null,
val fontFamily: FontFamily? = null,
val fontFeatureSettings: String? = null,
val letterSpacing: TextUnit = TextUnit.Unspecified,
val baselineShift: BaselineShift? = null,
val textGeometricTransform: TextGeometricTransform? = null,
val localeList: LocaleList? = null,
val background: Color = Color.Unspecified,
val textDecoration: TextDecoration? = null,
val shadow: Shadow? = null
) {
...
}
class ParagraphStyle constructor(
val textAlign: TextAlign? = null,
val textDirection: TextDirection? = null,
val lineHeight: TextUnit = TextUnit.Unspecified,
val textIndent: TextIndent? = null
) {
...
}
0 件のコメント:
コメントを投稿