Gratzi
Gratzi

Reputation: 4703

New line after space

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.

Upvotes: 0

Views: 931

Answers (1)

trojanfoe
trojanfoe

Reputation: 122458

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");

Upvotes: 2

Related Questions