Android Question How to get the real runtime width of a label?

Bindes1974

Member
Licensed User
Longtime User
Hi all!
Is there a way to obtain the real runtime width of a label? I can't get it reading the width property cause it is set to -2 (autosize).
I'd like to know the real width after setting the text property. Is it possible?
Otherwise it would be enough to find a way to calculate the size in pixel of a given string with a given typeface and textsize.
Thanks in advance.
 

Bindes1974

Member
Licensed User
Longtime User
Great, but this is not exactly what i need. Anyway in this source code i found the function i could use:
Canvas.MeasureStringWidth() function is what i need!!
 
Upvote 0
Top