android - 将 RemoteViews 中的 TextView 设置为 CSS 样式的 html 文本
问题描述
我正在使用以下代码在 a 中设置文本TextView
(本身在 aRemoteViews
中),htmlText
下面是用 html 标记包装的文本,包括用于设置文本颜色和粗细的 css 样式:
Spanned styledText = Html.fromHtml(htmlText, FROM_HTML_MODE_LEGACY);
remoteViews.setTextViewText(R.id.text_view, styledText);
文本至少被解释为 html 文本(即我看到文本,而不是标记),但是诸如style="font-size:52.03px;font-weight:bolder;color:rgba(51, 51, 51, 1);"
被忽略的样式......我特别希望文本颜色得到尊重......不那么在意重量和尺寸。
如何让 html 标记中的 css 样式得到尊重?
解决方案
推荐阅读
- java - Junit 测试单独通过,而不是分组通过
- git - Git - 不同版本之间的合并
- entity-framework - 当有多个包含时,从 ef core 2.2.6 迁移到 3.1 会出现问题
- javascript - 尝试覆盖现有 POST 后如何修复 401?
- mysql - 有人可以帮助解决以下语法错误
- deep-learning - 使用 Coral 开发板作为加速器
- bash - 带有 YAD 的 BASH 以显示平均 ping
- android - NotificationCompat.Builder setContentText() 在深色模式下不显示 CSS 颜色
- javascript - Ajax 和 Vue cli
- forms - 当我在文本区域(如 < > & /)中写一个特殊字符时,它会忽略其余代码