How to put space character into a string name in XML?

Andreas picture Andreas · Jun 2, 2012 · Viewed 156.7k times · Source

i have defined some strings in the strings.xml file. Now I need to put some extra space between some numbers in the string. When I type extra space characters this is not showing on the application though.

Before:

<string name="spelatonertext3">-4, 5, -5, 6, -6,

And if I put extra space like this:

<string name="spelatonertext3">-4,  5, -5,   6,  -6,

It just looks the same on the app. How can I make space characters into the XML string?

Answer

ρяσѕρєя K picture ρяσѕρєя K · Jun 2, 2012

to use white space in xml as string use &#160;. XML won't take white space as it is. it will trim the white space before setting it. So use &#160; instead of single white space