Prevent Android Dialog from Indenting Each Paragraph of Text

android, android-alertdialog, indentation

Solution

The extra space you see is caused by the indentation of your paragraph in the string resources. When you just break the line, your indentation serves as the break between words and you see it as the space. However when you have a new-line, indentation is displayed as the space before the beginning of each paragraph. To get rid of it, you need to either put your `\n` directly before the first letter of the next paragraph or not indent your lines. BTW, a line break on its own may also lead to a space when rendered. Either of these two should work:

(1)

<string name="about_app">
        Blah blah blah talking about stuff this is a line
        Oh look I continued onto another line! Now I want these...\n

        \nSo this is another paragraph! Intriguing. Yes, onto the next line 
        Android text doesn't necessarily consider this a new line, which is fine
        becauase i only care about paragraphs, which I'm using backslash n's for!\n

        \nAnd...here's my final statement! Woo.\n
</string>

or (2)

<string name="about_app">
Blah blah blah talking about stuff this is a line
Oh look I continued onto another line! Now I want these...\n\n
So this is another paragraph! Intriguing. Yes, onto the next line 
Android text doesn't necessarily consider this a new line, which is fine
becauase i only care about paragraphs, which I'm using backslash n's for!\n\n
And...here's my final statement! Woo.\n
</string>

Problem

I believe I've seen a question like this before but I can't find it anywhere... so, I'll post my version of the question unless someone else knows the link for it. Anyways... I have an `AlertDialog` that is bringing up a string in my `strings.xml` file to display inside the dialog. The string looks something like this: ``` <string name="about_app"> Blah blah blah talking about stuff this is a line Oh look I continued onto another line! Now I want these...\n\n So this is another paragraph! Intriguing. Yes, onto the next line Android text doesn't necessarily consider this a new line, which is fine becauase i only care about paragraphs, which I'm using backslash n's for!\n\n And... here's my final statement! Woo.\n </string> ``` Everything displays (somewhat) correctly in the AlertDialog. "Blah blah blah..." lines up with the left edge of the `AlertDialog` and continues on until it hits `\n\n`. From here, I get the spacing I want before "So this is...". However, "So this is..." is indented one annoying little space that I can't get rid of! Same for "And... here's my...". Does anyone have a solution to this? Note: I've tried bringing getting rid of the empty line after each paragraph in the code - does nothing. I also ensured there's no spaces after my `\n`s.

Original source