Hello. When I try to adjust the height of a label view containing Chinese words, sometimes the height cannot be adjusted correctly. Is it my coding error or intrinsic problem? Thank you
B4X:
Sub Globals
Dim Lb1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim su As StringUtils
Lb1.Initialize("")
Lb1.Gravity=Bit.Or(Gravity.TOP,Gravity.CENTER_HORIZONTAL)
Lb1.TextSize=20:Lb1.textcolor=Colors.black:Lb1.color=Colors.yellow
Lb1.Text="東南西北" &CRLF&CRLF& "東南西北" &CRLF&CRLF& "東南西北"
Activity.AddView(Lb1,0,0,Activity.Width,0)
Lb1.Height=su.MeasureMultilineTextHeight(Lb1,Lb1.Text)
End Sub
For curiosity , I tested with your code and also using the Designer and it worked just as intended. Now, you need to wait for Erel to give you a better answer.
For curiosity , I tested with your code and also using the Designer and it worked just as intended. Now, you need to wait for Erel to give you a better answer. View attachment 120378
Thank you! It's strange. And with two CRLF between each line theoretically there should be two empty lines between the three lines of text. So strictly speaking what's shown in your screenshot is not completely "right". But yea, let's wait for Erel.