How to put space character into a string name in X

2019-01-21 01:40发布

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?

14条回答
淡お忘
2楼-- · 2019-01-21 02:02

If you are trying to give Space Between 2 string OR In String file of android then do this in your string file . Implement this before your "String name" that you want to show. \u0020\u0020 For E.g.. \u0020\u0020\u0020\u0020\u0020\u0020Payment

查看更多
姐就是有狂的资本
3楼-- · 2019-01-21 02:05

Insert \u0020 directly in the XML for a blank you would like to preserve.

<string name="spelatonertext3">-4, \u00205, \u0020\u0020-5, \u00206, \u0020-6,</string>
查看更多
唯我独甜
4楼-- · 2019-01-21 02:05

Put &#160; in string.xml file to indicate a single space in an android project.

查看更多
戒情不戒烟
5楼-- · 2019-01-21 02:08

The only way I could get multiple spaces in middle of string.

<string name="some_string">Before" &#x20; &#x20; &#x20;"After</string>

Before   After
查看更多
Lonely孤独者°
6楼-- · 2019-01-21 02:10

This should work as well. Use quotes to maintain space

<string name="spelatonertext3">"-4,  5, -5,   6,  -6,"</string>
查看更多
爱情/是我丢掉的垃圾
7楼-- · 2019-01-21 02:13

Space variants:

<string name="space_demo">|&#x20;|&#x2009;|&#x200A;|</string>

| SPACE | THIN SPACE | HAIR SPACE |

查看更多
登录 后发表回答