-4

How to achieve TextView with text like below image:

enter image description here

Below solution provide me thoroug code. Subscript and Superscript a String in Android

How to add String for above image in string.xml?

Community
  • 1
  • 1
pRaNaY
  • 24,642
  • 24
  • 96
  • 146

2 Answers2

3

Have your string defined in strings.xml as follow :

<string name="fourth">4&lt;SUP&gt;&lt;/SUP&gt;</string>

And if you need to call it from code, use :

myTextView.setText(Html.fromHtml(getString(R.string.fourth)));
NSimon
  • 5,212
  • 2
  • 22
  • 36
0

Try this:

((TextView)findViewById(R.id.text)).setText(Html.fromHtml("4<sup>th</sup>"));
Palejandro
  • 2,092
  • 5
  • 26
  • 38