Reputation: 7799
Please, explain me how can I add a new line in xml only (when I will use this string in program this must be single line)?
For example:
<string name="test">This
is
test
line</string>
But in program when I will use getString(R.string.test);
it will load single string without some new line characters: This is test line
.
I need this only for file formatting.
Upvotes: 0
Views: 278
Reputation: 12121
If you want to force a newline in the XML string just use '\n' (assuming your TextView is sized properly):
<string>This\nis\ntest\nline</string>
Output
This
is
test
line
See: How to insert a new line in strings in Android
Otherwise you can inject in a blank space  
or  
for adjusting your string formatting.
See: How to put space character into a string name in XML?
Upvotes: 1