6

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?

mabs
  • 987
  • 1
  • 10
  • 17

2 Answers2

7

Let's try this:

For Android:

myLabel.android.setMaxLines(2);

For iOS:

myLabel.ios.numberOfLines = 2
Dean Le
  • 2,094
  • 13
  • 17
  • 7
    Thanks, based your suggest I wrote an {N}-angular-directive for it: https://gist.github.com/m-abs/ff9da8ed6c01c5c5115da37e4b535a2a – mabs Mar 10 '17 at 14:40
0

To add an ellipsis('... ') at the end to indicate that the text is cutoff, implement the directive at the below link. The above one doesn't have any,

https://gist.github.com/EddyVerbruggen/8232252e3a4667e7e20916279f98d3fc

Kamil Kafoor
  • 256
  • 3
  • 8