Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NativeScript: max number of lines on a Label

If I add textWrap="true" to a Label, text is wrapped over several lines, so far so good.

But I have a very long string and our design only have room for two lines. How do I limit the Label to max two lines?

I'd prefer not to set a height, since that would leave an empty line for texts that could fit on one line?

like image 682
mabs Avatar asked Mar 10 '17 10:03

mabs


1 Answers

Let's try this:

For Android:

myLabel.android.setMaxLines(2);

For iOS:

myLabel.ios.numberOfLines = 2
like image 169
Dean Le Avatar answered Nov 05 '22 20:11

Dean Le