简体   繁体   中英

Incorrect display text in TextView via Html.fromHtml()

in my app i have string (for example) :

String s = "log<small><sub>(log<small><sub>(log<small><sub>3<small><sup>2</sup></small></sub></small>(40))</sub></small>(39!))</sub></small>(40!)" .

It's a mathematical expression, as you see. And when i do myTextView.setText(Html.fromHtml(s)) text in TextView incorrect displayed (see on logarithm base 3^2):

不正确的

but in browser this String displayed correct (try it if you want): 在此处输入图片说明

WHY?

As i guessed earlier, the problem was in xml file...I copied your text but it shows the error like you said. But, then I changed the layout_width to fill_parent

and it is now fine...

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