Superscript layout in android
-
22-06-2021 - |
Question
I am on making a widget layout, I need to display superscript
type thing like , like PM
displaying in this picture, I am thinking if there is any tool which acts like superscript. Will appreciate your help.
Solution
You want to use Html#fromHtml and use the HTML < sup > tag.
Here is what it will look like if you set the text in a TextView
in java:
textView.setText("3:36" + Html.fromHtml("<sup>PM</sup>"));
More info can be found on this SO Post: Subscript and Superscript a String in Android
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow