tags:

views:

44

answers:

1

I am trying to make a fraction:

I am using this is a text view but it is not rendering very nicely:

"5"+'\u2044'+"9";

It does not turn the text into a nice fraction instead it sort of covers part of the numbers and squishes them together.

Any solutions or alternatives?

+1  A: 

Try:

tv.setText(Html.fromHtml("<sup>5</sup>/<sub>9</sub>"));

Don't know if that will look good, but it's worth a shot. Otherwise, other than the single-glyph fractions like 1/2, I suspect you either will need to go without or render it yourself.

CommonsWare
"Html.fromHtml" this is a little treasure. Do you know where they list the HTML tags that are available?
jax
They don't. I happened to blog on this very topic just yesterday: http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html
CommonsWare