I want to display a string with leading whitespace in a Textview. But what I can see is that the android Textview is trimming all leading/trailing whitespace. Is there a way to turn this behavior off?
Old question but if you are not satisfied with "It Does Not trim itself." answer from comments this might help you.
If you are using resource strings with leading or trailing spaces, this is your issue: How to keep the spaces at the end and/or at the beginning of a String?
TextView indeed doesn't trim whitespaces but whatever reads strings from XML does. Use \u0020
instead of spaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With