Hot to write this type of fraction Value in java or android code as shown above ? Any idea/suggestion will be appreciated.
Asked
Active
Viewed 312 times
1
-
1Please refer to http://stackoverflow.com/questions/474535/best-way-to-represent-a-fraction-in-java – Larry Morries Oct 12 '11 at 08:48
2 Answers
1
Do you mean how to display it? Unicode provides fractions up to eighths (used in finance) http://tlt.its.psu.edu/suggestions/international/bylanguage/mathchart.html
On the other hand, if your output can render HTML, you can combine "sup" and "sub" tags
1 <sup><font size=-2>11</font></sup>/<sub><font size=-2>16</font></sub>
1 11/16

albertofaci
- 68
- 7
-
Right before the 11/16. I edited it and added it. It is put as normal character outside the sub or sup – albertofaci Oct 12 '11 at 09:15
0
My idea would be to create a sublcass the relativelayout and add 3 textviews for each number and the '/' as an image.
Another method would be to create a custom view and use the canvas to the draw the fraction.

blessanm86
- 31,439
- 14
- 68
- 79