Android Question How to set a label created in code to centered text alignment?

Troberg

Well-Known Member
Licensed User
Longtime User
I create a label in code, and add it using AddView. Most settings I can set through code, but I can't find how to set the text to centered alignment.

Is it possible?

B4X:
Dim lblName As Label
lblName.Initialize("lblName")
lblName.Text = Main.Glob.DisplayName
lblName.TextSize = 24
HostPanel.AddView(lblName, 0%x, 30%y, 100%x, 40%y)
 
Top