Html和设置文本转换为TextView的 [英] Convert Html and Set text to Textview

查看:182
本文介绍了Html和设置文本转换为TextView的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想转换一个HTML字符串,并将其设置为一个TextView,但我不能这样做完全。

I am trying to convert a html String and set it to a TextView but I couldn't do it exactly.

下面是我的字符串,你好,%1 $ S您有<!B>%2 $ D新消息< / B>

我使用的 textview.setText(Html.fromHtml(myString中)); 产生我与HTML标签,而不是纯文本的输出。谁能帮我这个?

I am using textview.setText(Html.fromHtml(myString)); which produces me an output with Html Tags instead of plain text. Can anyone help me with this?

任何帮助是非常AP preciated。 谢谢

Any help is much appreciated. Thanks

推荐答案

尝试使用<一个href="http://developer.android.com/reference/android/widget/TextView.html#setText%28java.lang.CharSequence,%20android.widget.TextView.BufferType%29"相对=nofollow>这个的版本的setText和使用SPANNABLE缓冲类型

Try use this version of setText and use SPANNABLE buffer type

这篇关于Html和设置文本转换为TextView的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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