Android Question Designer Scripts Question?

Bill Kantz

Member
Licensed 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
 

stevel05

Expert
Licensed User
Try setting the width before setting the horizontal center so it can calculate where the center should be.
 

RandomCoder

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