Android – How to put space character into a string name in XML

androidwhitespacexml

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?

Best Answer

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