Special characters in activity_main.xml

Hi all

How to insert special characters in android studio in activity_main.xml file under the heading Android Text " "

I have to insert Greek letter for micro (mu or u) and superscript 2 - as written in meter square m2, but 2 as a superscript, so that when these come on android screen are formatted properly.

Would appreciate solution. Thanks

And for unicode character codes, there are many multiple places to find them. First two results I get on Google when I search:

Thanks, I know about unicode characters, but how to add in xml file in android text

like, for micro the unicode is UB034 or U+0035, but if write in android text as “…UB034mol/L” then on screen it prints as such, as the information given in android text is in double quotation marks and it gets transferred as such on the screen. Is there a way as how to insert this unicode, specifically under heading android text, between the quotation marks “”

I know in microsoft word these can be done easily but here the question is about android text, in activity_main.xml file. Thanks

Ah, sorry. Well, just for the hex reference, XML should support it defined as:


for lowercase mu and


for superscript two.

Or just paste the actual character in? I’m not sure why that shouldn’t work, the rest of the characters in the file are also unicode, so if it didn’t support unicode they wouldn’t work either.

used \u03BC and \u00B2 and worked.

Thanks again

Note that form (the \u) is afaik dependent on the program dealing with that XML file being able to recognise that as a unicode character, it’s not technically supported by XML, so take care of you’re needing the same thing in other XML files – the form in my last post is standard and should work everywhere (in theory)

Thanks again, tried &#x03BC and &#x00B2 Both didn’t work in android studio. So reverted back to \u03BC and \u00B2 and those worked. May be is with android studio. I am new to programming and learning and doing things for fun, so don’t know much about these. Just wanted to let you know that I tried and android studio didn’t allow this .

Have a great day!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.