gpt4 book ai didi

android - 如何在 TextView 中显示带有 css 样式表的 html?

转载 作者:行者123 更新时间:2023-11-27 23:41:13 27 4
gpt4 key购买 nike

将 html 文件转换为跨区对象并将其显示在 TextView 中效果很好,但如果我还想应用 css 样式怎么办?我尝试将 css 样式与 html 文件结合使用,但 Html.fromHtml() 方法忽略了样式。

如何在我的 TextView 中显示由 css 样式修改的文本?

最佳答案

what if I want to also apply css styles?

Html.fromHtml() 不支持。您将需要构建您自己的 HTML/CSS 解析器并构建您自己的格式化字符串,也许使用 SpannableStringBuilder

关于android - 如何在 TextView 中显示带有 css 样式表的 html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31662943/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com