Android Question [solved] Is it wrong to make an app which uses less than fullscreen?

Martincg

Member
Licensed User
Zipped sample to demonstrate the problem is included.
A button is on a panel which is 80%x by 80%y.
If I place a button like this
Button1.right = 80%x
and run the script in debug mode, the button1.right is at 90%x as far as a rough measurement tells me, but visually you can see it's at 90% because the right edge of the button is against the right edge of the panel.
If I increase the panel width to 100%, then the button1.right shifts to 80%x where it should be.

I can fix my problem by having a full screen panel in the background and making that the parent of everything else, but can someone explain this to me?
Should I always have a layout which uses the full screen?
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
Tip: better not to use the variant specific script. Use the general one and use as few as possible variants.

90%x in the designer script means 90% of the width of the container that loaded the layout. In your case it is the activity.

You can create a panel with another layout file and then load the second layout into the new panel. In that case 90%x will be relative to the panel width.

I recommend you to use anchors instead of these percantages (except of the panel which is centered).
 

Martincg

Member
Licensed User
When Erel says in the design tutorial
"- %x and %y values are relative to the view that loads the layout."
he doesn't mean what I thought he meant. So
button.right = 80%x
doesn't put the button right at 80% of the width of the view that holds the layout, but 80% of the that views width plus the left position of the parent of the button.
So if I want it at 80% of the screen width then I say
button.right = 80%x - parentOfButton.left.
Anything you learn can become obvious.
 
Top