0

Usually I use <![CDATA[..here's text]]> in my Resources Strings so when I do

Spanned sp=Html.fromHtml(getResources.getString(R.string.myString));
myTextView.setText(sp);

I get text with all the tags like ,
etc working as they should.

but now I build String during some metod like :

String result="<![CDATA[";
//some code
result+="<b>Chapter :"+chapterNumber+"</b><br /><br />"
//some other additions and in the end
result+="]]>";

Spanned sp = Html.fromHtml(result);
myTextView.setText(sp);

and I see all my tags on the screen instead of them being implemented, like : Chapter :1

...

I tried to use StringBuilder instead, but result is the same.

What should I do for the tags to word right in my case?

4

1 回答 1

1

在我的情况下,我应该怎么做才能正确使用标签?

摆脱CDATA

Spanned sp = Html.fromHtml("<b>Chapter :"+chapterNumber+"</b><br /><br />");
myTextView.setText(sp);
于 2013-12-14T17:21:52.610 回答