Android Question Designer Scripts Question?

Discussion in 'Android Questions' started by Bill Kantz, Mar 14, 2015.

  1. Bill Kantz

    Bill Kantz Member Licensed User

    I have a designer script to horizontalaly center a label.

    this script works

    Code:
    AutoScaleAll

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

    Code:
    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
     
  2. stevel05

    stevel05 Expert Licensed User

    Try setting the width before setting the horizontal center so it can calculate where the center should be.
     
    NJDude likes this.
  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

    HorizontalCenter returns the position of the parent view at which the center point is located.
     
  4. Peter Simpson

    Peter Simpson Expert Licensed 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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice