-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
  • 23,128
  • 23
  • 90
  • 142

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,082
  • 2
  • 20
  • 34
0

Try this:

((TextView)findViewById(R.id.text)).setText(Html.fromHtml("4<sup>th</sup>"));
Palejandro
  • 1,920
  • 4
  • 23
  • 34