user963241 user963241 - 1 year ago 59
Android Question

Paragraph line alignment XML

I have an XML file like this:

<resources>
<string name="app_name">My Application</string>

<string name="mytext">Some long line\n
Some long line\n
Some long line\n
Some long line\n
</string>

</resources>


In which I have some long lines of text I want to display but the XML produces the following output on screen:

enter image description here

Why are the rest of the lines after first not aligned with first line?

Answer Source

The problem can be solved by preceding \n. Something like this:

<resources>
<string name="app_name">MyProj</string>
<string name="mytext">Some long line
    \nSome long line
    \nSome long line
    \nSome long line
</string>

I think the trailing \n were causing the problem.