如何在 TextView 中使用 css 样式表显示 html?
How to display html with css stylesheet in TextView?
将 html 文件转换为跨区对象并将其显示在 TextView 中效果很好,但如果我还想应用 css 样式怎么办?
我尝试将 css 样式与 html 文件组合,但 Html.fromHtml() 方法忽略了样式。
如何在我的 TextView 中显示由 css 样式修改的文本?
what if I want to also apply css styles?
Html.fromHtml()
不支持。您将需要构建自己的 HTML/CSS 解析器并构建自己的格式化字符串,也许使用 SpannableStringBuilder
.
将 html 文件转换为跨区对象并将其显示在 TextView 中效果很好,但如果我还想应用 css 样式怎么办? 我尝试将 css 样式与 html 文件组合,但 Html.fromHtml() 方法忽略了样式。
如何在我的 TextView 中显示由 css 样式修改的文本?
what if I want to also apply css styles?
Html.fromHtml()
不支持。您将需要构建自己的 HTML/CSS 解析器并构建自己的格式化字符串,也许使用 SpannableStringBuilder
.