Issue
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.
Solution
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?
Answered By - Morrison Chang
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.