Skip to content Skip to sidebar Skip to footer

Android - Displaying Fractions Using Unicode

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 so

Solution 1:

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.

Post a Comment for "Android - Displaying Fractions Using Unicode"