Arci
Arci

Reputation: 6819

Superscript affects line height

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

Answers (2)

Arci
Arci

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

Related Questions