JetPack中的HTML撰写文本
我试图启用html字符串,尤其是使用链接:
"We are a <a href="/about/about_team.htm">team</a> of professionals working hard to provide free learning content."
我用它来解释在这里,Akram Hussain
val body = "We are a <a href="www.link.com/about/">team</a> of professionals working hard to provide free learning content."
val text = HtmlCompat.fromHtml(body, Html.FROM_HTML_MODE_LEGACY)
// HtmlCompat.fromHtml(description, HtmlCompat.FROM_HTML_MODE_LEGACY)
Text(
text = text.toString(),
style = myStyle,
overflow = TextOverflow.Ellipsis,
maxLines = 4,
modifier = Modifier
.clickable(
enabled = true,
onClick = { },
indication = rememberRipple(bounded = true),
interactionSource = MutableInteractionSource(),
)
.animateContentSize(animationSpec = spring()),
onTextLayout = {
//
}
)
in A akram hussain > androidx.compose.material.textkt.kt 文本。不幸的是,该文本已显示,但是没有突出显示链接,链接根本不起作用。
I tried to enable HTML strings, especially with links e.g.:
"We are a <a href="/about/about_team.htm">team</a> of professionals working hard to provide free learning content."
I used it like explained here by Akram Hussain:
val body = "We are a <a href="www.link.com/about/">team</a> of professionals working hard to provide free learning content."
val text = HtmlCompat.fromHtml(body, Html.FROM_HTML_MODE_LEGACY)
// HtmlCompat.fromHtml(description, HtmlCompat.FROM_HTML_MODE_LEGACY)
Text(
text = text.toString(),
style = myStyle,
overflow = TextOverflow.Ellipsis,
maxLines = 4,
modifier = Modifier
.clickable(
enabled = true,
onClick = { },
indication = rememberRipple(bounded = true),
interactionSource = MutableInteractionSource(),
)
.animateContentSize(animationSpec = spring()),
onTextLayout = {
//
}
)
in a androidx.compose.material.TextKt.kt
Text. Unfortunately, the text is shown, but no link is highlighted and link is not working at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论