Android Question unable to get required output from designer script need help


Hi, I am trying to design a panel, where my design is independent of screen size from tutorial Visual Designer

I want to design user interface for all screen , so i have written this script so all my Boxes are unifromly seen on all screen size,

Designer script:
'All variants script

Panel1.SetLeftAndRight( 5dip, 50%x)
Panel2.SetLeftAndRight( Panel1.Right + 5dip, 100%x - 5dip)
Panel3.SetLeftAndRight( 5dip, 50%x)
Panel4.SetLeftAndRight( Panel3.Right + 5dip, 100%x - 5dip)

topofbox = Label3.Bottom + 10dip

lengthofbox = 100%y - topofbox

Panel3.SetTopAndBottom( lengthofbox/ 2 + 5dip, 100%y - 5dip)
Panel1.SetTopAndBottom( Label3.Bottom + 10dip,  lengthofbox/2 + 5dip )

I want to form a rectangle from position topofbox to 100%y, in this rectangle evenly place all 4 panel so they can have equal amount of space and gap between them on any screen size

variable lengthofbox is total length od rectangle on y axis, by /2 i am expecting to get panel1 and panel3 in half space of rectangle top and bottom

But it is not, i failed to see end result, need little guidance


  • Screenshot 2021-05-27 112959.jpg
    Screenshot 2021-05-27 112959.jpg
    31.5 KB · Views: 33


Licensed User
Longtime User
Try with:
topofbox = Label3.Bottom + 10dip

MiddleOfBox = (100%y + topofbox) / 2

Panel3.SetTopAndBottom(MiddleOfBox + 5dip, 100%y - 5dip)
Panel1.SetTopAndBottom( topofbox,  MiddleOfBox + 5dip )
Upvote 0