Make TextView "\n" ignore paragraph creation

rwojcik :

I have a string of text like this with few newline control characters.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

When I use LeadingMarginSpan on the TextView, it applies after every newline character.

leading margins

^ This is the result I get from applying a LeadingMarginSpan.

enter image description here

^ And this is the result I'd like to have.

Is there any way to ignore paragraphs in TextView so we can just have a normal line break?

okacat :

You can apply LeadingMarginSpan.Standard(inset, 0) from 0 to the first new line only, so it doesn't apply to the rest of the paragraphs.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=7040&siteId=1