安卓:获得[OBJ]使用Textview.SetText(characterSequence) [英] Android :getting [OBJ] using Textview.SetText(characterSequence)

查看:598
本文介绍了安卓:获得[OBJ]使用Textview.SetText(characterSequence)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我越来越[OBJ]显示,当我尝试在一个文本设置ImageSpan在屏幕上View..it显示在屏幕上,即/ uFFFC UNI code字而不是图像与OBJ一个虚线框写在里面。

I am getting [OBJ] displayed on the screen when I try to set a ImageSpan on a text View..it shows a /uFFFC unicode character instead of the image on the screen,i.e. a dotted box with OBJ written inside it.

推荐答案

我面临同样的问题,所以我只是想有HTML剥离和刚刚获得的字符串

I faced the same problem, thus I just wanted to have the HTML stripped and just get the String.

解决的办法可能不是最漂亮的一个,但仍然pretty的实用主义:

The solution is probably not the most beautiful one, but still pretty pragmatical:

public CharSequence stripHtml(String s) {
    return Html.fromHtml(s).toString().replace('\n', (char) 32)
        .replace((char) 160, (char) 32).replace((char) 65532, (char) 32).trim();
}

这[OBJ]人物似乎是(字符)65532

This [OBJ] character seemed to be (char) 65532.

我必须显示在的TextView 一个非常难看的RSS项目的(HTML)的描述字段不格式。超文本包含了许多所见即所得的碎片像< P>< / P>< P>< / P> ...

I had to display a very ugly RSS item's (HTML) description field in a TextView without formats. The hypertext contained a lot of WYSIWYG debris like <p></p><p></p>

这篇关于安卓:获得[OBJ]使用Textview.SetText(characterSequence)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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