Android line break adds padding

I have 5-10 lines of address information that I want to insert into the layout in my Android application. I prefer not to use separate text images, but want to have one where I can manually insert line breaks.

I do this by adding \ n and it seems to work, BUT .. It also adds a space or a space, I'm not sure which one.

Example:

This xml

<string name="contact_address">
    Street address\n
    City\n
    Country
</string>

Gives this conclusion:

Street address
 City
 Country

Does anyone know what might be wrong, or should I refuse and do 5-10 separate text views?

+5
source share
1 answer

Try:

<string name="contact_address">Street address\nCity\nCountry</string>

to get rid of the spaces you put in your XML.

+6

All Articles