0

Is there a way to have a TextView that adds a new line after each space character in the text? For example, the text "one two three" should be displayed on 3 lines.

1 Answer 1

2

Can't you modify the text before it's added to the ListView to translate whitespace to newline?

String text = "one two three";
text.replaceAll("\\s", "\n");
2
  • I could. But I was wondering if there is an "automatic" way to do it. Like a combination of xml attributes.
    – Gratzi
    Feb 15, 2011 at 8:33
  • I don't believe so - it's not something many people would find useful. Correcting text before insertion is fairly standard pattern.
    – trojanfoe
    Feb 15, 2011 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.