I was looking for a way to determine the height of a textview when it has multiline text. This function now makes that possible across platforms. From B4J I come from this thread: https://www.b4x.com/android/forum/threads/measure-multiline-text-height.84331/#content Private Sub...
www.b4x.com
or use just this 2 lines:
B4X:
Dim su As StringUtils
Return su.MeasureMultilineTextHeight(xLabel,xLabel.Text)
Note that it only works if the label you are using has its final width and the final font size, only then can the correct height be calculated.
I was looking for a way to determine the height of a textview when it has multiline text. This function now makes that possible across platforms. From B4J I come from this thread: https://www.b4x.com/android/forum/threads/measure-multiline-text-height.84331/#content Private Sub...
www.b4x.com
or use just this 2 lines:
B4X:
Dim su As StringUtils
Return su.MeasureMultilineTextHeight(xLabel,xLabel.Text)
Note that it only works if the label you are using has its final width and the final font size, only then can the correct height be calculated.
In my example, I corrected the value in the constructor to SingleLine=True.
Nothing has changed, the height will still need to be doubled.
Tell me, please, how to set the label width correctly?