T Troberg Well-Known Member Licensed User Longtime User Mar 27, 2015 #1 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)
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)
fixit30 Active Member Licensed User Longtime User Mar 27, 2015 #2 You could try: B4X: lblName.Gravity = Gravity.CENTER_HORIZONTAL Upvote 0