【发布时间】:2020-05-22 15:42:43
【问题描述】:
这是完美的工作
val htmlContent = "<p><span style=\"background-color: #008080;\">Heloo This is new <span style=\"color: #0000ff;\">document</span> <span style=\"background-color: #ffffff;\"> TEXTT HHHH<strong>Hhhhhhhh</strong>hhhhhhhhhhhhh</span></span></p>\n" +
"<h1><span style=\"background-color: #008080;\"><span style=\"background-color: #ffffff;\">TEst dfsdf </span></span></h1>"
但是当我尝试将其设置在 Html 内容下方时,它在 android 中无法正常工作,但在 ios 中却可以正常工作
<p style="text-align:left;"></p>
<p style="text-align:justify;"><span style="color: rgb(250,197,28);background-color: rgb(255,255,255);font-size: 14px;font-family: Open Sans;"><strong>Yellow </strong></span><span style="color: rgb(0,0,0);background-color: rgb(255,255,255);font-size: 14px;font-family: Open Sans;"><strong>Ipsum</strong></span> <span style="color: rgb(0,0,0);background-color: rgb(255,255,255);font-size: 24px;font-family: Open Sans;">is simply </span><span style="color: rgb(209,72,65);background-color: rgb(255,255,255);font-size: 24px;font-family: Open Sans;">Red</span><span style="color: rgb(209,72,65);background-color: rgb(255,255,255);font-size: 14px;font-family: Open Sans;"> </span><span style="color: rgb(0,0,0);background-color: rgb(255,255,255);font-size: 14px;font-family: Open Sans;">text </span><span style="color: rgb(65,168,95);background-color: rgb(255,255,255);font-size: 14px;font-family: Open Sans;">greenthe </span><span style="color: rgb(0,0,0);background-color: rgb(255,255,255);font-size: 14px;font-family: Open Sans;">printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span></p>
<p style="text-align:left;"><br> </p>
Kotlin 代码
descriptionTextView.text = Html.fromHtml(
htmlContent, Html.FROM_HTML_MODE_LEGACY)
【问题讨论】:
标签: android html ios kotlin textview