Android Question Canvas.MeasureStringWidth

ykucuk

Well-Known Member
Licensed User
Hi

Canvas.MeasureStringWidth doesn't work when text is long or include CRLF

Any help?
 

ykucuk

Well-Known Member
Licensed User
I am trying to create chat bubble. I need to change the width of bubble according to text length.
 

Erel

Administrator
Staff member
Licensed User
Assuming that Label.SingleLine is False then the text will be wrapped if it is too long. Canvas.MeasureStringWidth will return the string length without the text being wrapped.

StringUtils.MeasureMultilineTextHeight will return the correct height with the wrapped text.
 

ykucuk

Well-Known Member
Licensed User
StringUtils.MeasureMultilineTextHeight is work fine.

What I want to to do: message "ok" and "how are you" should be the different width. I need calc this width.
 

Erel

Administrator
Staff member
Licensed User
Canvas.MeasureStringWidth should work with these strings.
 
Top