Android的Html.fromHtml(字符串)不工作<字体颜色='#'>文字< / FONT> [英] Android Html.fromHtml(String) doesnt work for <font color='#'>text</font>

查看:1019
本文介绍了Android的Html.fromHtml(字符串)不工作<字体颜色='#'>文字< / FONT>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

无论出于何种原因,

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

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

解决方案

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

取而代之的是请使用此

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

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

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

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.

这篇关于Android的Html.fromHtml(字符串)不工作&LT;字体颜色='#'&GT;文字&lt; / FONT&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆