简体   繁体   中英

java Android Spanned Html.fromHtml(stringWithCDATA) still shows tags as text

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

  



...

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

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

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

Get rid of the CDATA :

Spanned sp = Html.fromHtml("<b>Chapter :"+chapterNumber+"</b><br /><br />");
myTextView.setText(sp);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM