Tuesday, July 27, 2010

How to add leading and trailing spaces in string.xml

Even if you use string formatting sometimes you still need white spaces at the beginning or the end. On these cases neither escaping with \ nor using   or the xml:space attribute helps.
You must use the UTF character \u0020 for white spaces. Just type this succession of characters and it will be interpreted as a space. The \u part tells android that the following number represents the character in the UTF table.