SubName: MeasureText Description: I came across this while searching the internet. As it seems useful I thought I'd share it. It uses TextBuilder to measure the size of text to be displayed. It uses a Data 'Type' Structure to return the Height and Width, you can deal with this however you...
Sub Process Globals
Public access As Accessiblity
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1") 'Layout1 คือ Layout ที่ถูกสร้างขึ้นเพื่อรองรับ View ต่างๆ
ResetUserFontScale(Activity)
End Sub
Sub ResetUserFontScale(p As Panel)
For Each v As View In p
If v Is Panel Then
ResetUserFontScale(v)
Else If v Is Label Then
Dim lbl As Label = v
lbl.TextSize = lbl.TextSize / access.GetUserFontScale
Else If v Is Spinner Then
Dim s As Spinner = v
s.TextSize = s.TextSize / access.GetUserFontScale
End If
Next
End Sub