I've tried to simplify this question down to the basics. Please don't be sidetracked by what the resulting screen might actually look like in portrait or landscape or even in moonscape
Assume that I have five buttons down the screen, and I want them to all be the same size and evenly spaced, on any screen.
I decided by observing what looked best, on the following "rules":
1. The first button should start 10% of the screen height down from the top of the screen.
2. Each button should be 15% high
3. Each button should be 18% of the screen down from the previous button, to leave a 3% high blank space between the buttons.
4. 10% of the screen width should be blank on either side of the buttons.
So, I created the following Designer script:
This seems to produce exactly what I want, on my own phone (a Nexus 4). I haven't yet tested it on any other screen.
My question is, is this the "right" way to do it?
Assume that I have five buttons down the screen, and I want them to all be the same size and evenly spaced, on any screen.
I decided by observing what looked best, on the following "rules":
1. The first button should start 10% of the screen height down from the top of the screen.
2. Each button should be 15% high
3. Each button should be 18% of the screen down from the previous button, to leave a 3% high blank space between the buttons.
4. 10% of the screen width should be blank on either side of the buttons.
So, I created the following Designer script:
B4X:
'All variants script
AutoScaleAll
btn1.SetTopAndBottom(10%y, 10%y + 15%y)
btn1.SetLeftAndRight(10%x, 90%x)
btn2.SetTopAndBottom(28%y, 28%y + 15%y)
btn2.SetLeftAndRight(10%x, 90%x)
btn3.SetTopAndBottom(46%y, 46%y + 15%y)
btn3.SetLeftAndRight(10%x, 90%x)
btn4.SetTopAndBottom(64%y, 64%y + 15%y)
btn4.SetLeftAndRight(10%x, 90%x)
btn5.SetTopAndBottom(82%y, 82%y + 15%y)
btn5.SetLeftAndRight(10%x, 90%x)
This seems to produce exactly what I want, on my own phone (a Nexus 4). I haven't yet tested it on any other screen.
My question is, is this the "right" way to do it?