So far I did not find how to get StaticLayout to restrict text drawing to one line only.
The StaticLayout class does have a lot of methods to deal with ellipsis, but my guess is that ellipsis will appear only if the whole canvas is filled with text and there is still not enough space to display the whole text.
Note: I don't want to resize the text to fit, I want to keep my chosen text size and just have it clipped if it is too long.
I solved this using a BoringLayout instead of a StaticLayout. A BoringLayout will clip and text that does not fit in the width. Creation is similar is StaticLayout, although you must call isBoring to get the metrics to supply to the constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With