Reputation: 23035
How can I use escape characters in XML?
The situation is, I am a new android developer, and I need a string which need to be printed in 2 lines (other wise no space). This string is in string.xml file. I need to use /n line break character to break the string, but I don't know how to do it in XML file. Please help.
Upvotes: 0
Views: 326
Reputation: 379
See reference http://developer.android.com/guide/topics/resources/string-resource.html#String
line break symbol is \n
/n - is wrong. and you can write it in xml like it is.
Example:
<string name="multiline_text">line 1.\nline2.</string>
Upvotes: 1
Reputation: 18670
You can use double quotes:
<string name="mystring">"One line\nAnother line"</string>
Upvotes: 1