Android Question MeasureMultilineTextHeight inside customview

joneden

Active Member
Licensed User
Hi All

If I have a label inside a custom view and try to use MeasureMultilineTextHeight on it then I get an error Layout: -31 < 0

If I move the label outside the custom view it works just fine. I've tried several work arounds and short of somehow using a hidden panel to generate one off copies of labels to get their height I just can't figure it.

I also looked at a canvas approach but because you can't force the text width to allow wrapping to multiple lines you cant get the height - someone correct me if I have that wrong.

Any suggestions?

Regards

Jon
 

joneden

Active Member
Licensed User
Hi All

If I have a label inside a custom view and try to use MeasureMultilineTextHeight on it then I get an error Layout: -31 < 0

If I move the label outside the custom view it works just fine. I've tried several work arounds and short of somehow using a hidden panel to generate one off copies of labels to get their height I just can't figure it.

I also looked at a canvas approach but because you can't force the text width to allow wrapping to multiple lines you cant get the height - someone correct me if I have that wrong.

Any suggestions?

Regards

Jon
Me being dumb I think - please ignore!

I was assuming that the inner panel of an MSCardView held the width of the panel - it didn't and I forgot to check that it held a value... Like I said me being dumb,
 
Upvote 0
Top