Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String resource with index letter

Tags:

android

I have not found it anywhere so I am asking. How can I write string with upper index? Prefferably in resources. For example I want write square meters as m2 where 2 is upper index.

Thanks

like image 919
Martin Vandzura Avatar asked Jun 13 '12 09:06

Martin Vandzura


2 Answers

If it is only for ² and ³: Those are available at UTF 00B2 resp. 00B3 so you can just use the entity notation: The area is 2 m\u00B2.. Or use the character directly, if your keyboard supports it or copy and paste it into the file.

like image 199
Hauke Ingmar Schmidt Avatar answered Sep 28 '22 11:09

Hauke Ingmar Schmidt


try this

M<sup>2</sup>

or you can use textview.setText(Html.fromHtml("M<sup>2</sup>"));

Edited:

This is my string.xml

<string name="hello">Hello World<sup>2</sup></string>
like image 24
MAC Avatar answered Sep 28 '22 11:09

MAC