Reputation: 6819
When I display a text in TextView
containing a superscript, I noticed that the line height of the line where the superscript is written is larger. The line height difference is very noticeable.
How do I make the line height of all the lines the same regardless if I have a superscript or subscript? Or is there a way to set the superscript not to consume too much line height?
My code for my superscript is: <sup>123</sup>
. Then I am using Html.fromHtml
to make sure that it will be rendered using the Html tags.
I've also tried using: <sup><small>123</small></sup>
. But it only made the text smaller and the text did not become a superscript.
Upvotes: 1
Views: 1031
Reputation: 6819
Apparently, the <small>
tag works. I'm not sure why it didn't work on my first try but it must be because I have to clean Eclipse first. Anyways, to make the effect more visible, using the <small>
tag twice will do. As such it will be:
<small><small>superscript</small></small>
Upvotes: 4
Reputation: 15701
use unicode for that link "\u2122"
http://www.fileformat.info/info/unicode/char/2122/index.htm
so find same for 1 ,2 ,3
http://www.fileformat.info/info/unicode/char/00b9/index.htm
Unicode Character 'SUPERSCRIPT ONE' : \u00B9
http://www.fileformat.info/info/unicode/char/search.htm?q=2&preview=entity
Upvotes: 1