JamMaster
JamMaster

Reputation: 1454

How to force a TextView to wrap words

I'm having a bit of a problem. This is how my app looks:

https://i.sstatic.net/8wAN1.jpg

As you can see everything seems nice except the last editText and textView. I know that I can use stretch and shrink columns, but I don't want that because its going make some columns very compressed in comparison to others. I decided that I want to compress the textViews into 2 lines. So the question is: How do i force the TextViews to wrap to another line if there is more than 1 word? For example Black Steel, Bismuth Bronze and Sterling Silver should take 2 lines because there are 2 words. And the Steel(thats cut out on the picure) should take one line.

Upvotes: 0

Views: 2089

Answers (2)

fvasquezjatar
fvasquezjatar

Reputation: 278

or you can truncate the text using android:ellipsize and android:singleLine attribute on your TextView declaration.

android:singleLine="true"
android:ellipsize="end"

Upvotes: 0

Jim
Jim

Reputation: 10288

Use the newline "\n" escape character

Upvotes: 2

Related Questions