Search code examples
codenameone

Codename one how to cut a long string in a label


In case of a long string in my label, how can I cut it to fit in my card by adding 3 dots at the end as shown in the image below

enter image description here


Solution

  • This is automatic if a Label (not a SpanLabel) ends with 3 dots. This might have been disabled by your theme so you can explicitly enable it by using setEndsWith3Points.

    Notice that this will only show 3 points if the text is too long to fit the current layout.