Android的Html.fromHtml(字符串)不工作<字体颜色='#'>文字< / FONT>字符串、字体、颜色、文字

由网友(不过一场颠覆)分享简介:我想使用HTML标签不同颜色的线添加到我的TextView。无论出于何种原因,Html.fromHtml(<字体颜色='#145A14'>文字< / FONT>中);不会出现彩色的TextView的 - 任何人有任何建议解决方案 Html.fromHtml(<字体颜色='#145A1...

我想使用HTML标签不同颜色的线添加到我的TextView。

无论出于何种原因,

  Html.fromHtml(<字体颜色='#145A14'>文字< / FONT>中);
 

不会出现彩色的TextView的 - 任何人有任何建议

解决方案

  Html.fromHtml(<字体颜色='#145A14'>文字< / FONT>中);
 

取而代之的是请使用此

  Html.fromHtml(<![CDATA [<字体颜色='#145A14'>文字< / FONT>]]>中);
 
Android与Libgdx入门实例

这是对我的作品,我相信这也适用于你。

让我知道,如果任何问题。

I am trying to add lines with different colors to my TextView using html tags.

For whatever reason,

    Html.fromHtml("<font color='#145A14'>text</font>");

wont show up colored in the TextView -- anyone have any suggestions?

解决方案

Html.fromHtml("<font color='#145A14'>text</font>");

Instead of this please use this

Html.fromHtml("<![CDATA[<font color='#145A14'>text</font>]]>");

This is works for me, I am sure it also works for you.

Let me know if any issue.

阅读全文

相关推荐

最新文章