Android Question Designer Scripts Question?

Bill Kantz

Member
Licensed User
Longtime User
I have a designer script to horizontalaly center a label.

this script works

B4X:
AutoScaleAll

Label1.SetLeftAndRight(0,100%X)
Label1.SetTopAndBottom(2%Y,27%Y)
Label1.TextSize = 60

this one does not.

B4X:
AutoScaleAll

Label1.HorizontalCenter = 50%x
Label1.width = 100%x
Label1.SetTopAndBottom(2%Y,27%Y)
Label1.TextSize = 60

I assume HorizonalCenter doesn't work the way I think it does?

Bill
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
HorizontalCenter returns the position of the parent view at which the center point is located.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Label1.HorizontalCenter = 50%x works perfectly fine, I use it all the time. Do you really need your label to be 100% wide? Anyway just swap the first 2 Label1 lines around.
 
Upvote 0
Top