Android Question AutoScale? Best Idea??

persianpowerman1

Active Member
Licensed User
Longtime User
Guys want to know the best and most efficient way i could handle this...

I have a panel.. with Lables at the bottom...
BUT I WANT THOSE LABLES TO OCCUPY the entire LEFT to RIGHT of the screen... it shouldnt be less...

I have managed the Designer Script for the panel to occupy the entire screen... However... any cool or best idea or best practise... to do so for those 2 rows of Labels???

thanx ;-)
 

Attachments

  • Open.jpg
    Open.jpg
    7.2 KB · Views: 335

klaus

Expert
Licensed User
Longtime User
Here you are, attached your modified project.
In DesignerScripts, after the AutoScaleAll, the program :
- gets the Left property of the Label in the lower left corner as the margin Margin = Label12.Left.
- calculates the width of the Labels LabelWidth = (100%x - 2 * Margin) / 6
- then sets the Width, Left and Top propertyies for each Label

This is one solution, there are others.
- You could put all the Labels onto a Panel, in this case for the vertical positions you only need to set the panels bottom property.
- Or you could do in in the code, creating an Array of Labels and set them in a For / Next loop.
 

Attachments

  • MyTRY_1.zip
    7.3 KB · Views: 251
Upvote 0

persianpowerman1

Active Member
Licensed User
Longtime User
buddy... detailed.. and so clear!... thanx a million... i thought of this one too.. but wasnt sure if it were good enough...
however... i do like this other idea... but couldnt understand..
You could put all the Labels onto a Panel, in this case for the vertical positions you only need to set the panels bottom property.

?? never got the above line...
i understood the LOOP part too..

or are you trying to say... that if i put them on a panel... and set the Panel to AutoScale(panel1) they will all get sized poperly??

YO!han
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
or are you trying to say... that if i put them on a panel... and set the Panel to AutoScale(panel1) they will all get sized poperly??
No !
If you AutoScale(Panel1) once again you increase it once more because it was already scaled with AutoScaleAll.

Attached a project with the additional Panel.
I use this in my projects with a Panel of Buttons at the bottom of the screen.
 

Attachments

  • MyTRY_2.zip
    7.3 KB · Views: 275
Upvote 0

persianpowerman1

Active Member
Licensed User
Longtime User
ok... got it... works perfect....thanx buddy.. very helpful :)
Just 1 last question... while still on this topic...

What if i designed every thing according to a 400x800 screen size... so now when i need to autoscale... why cant i just do the following...

find out the new devices max X value(eg.600)... and find out its max Y value(eg.1600)
and then proportionally increase its widths and Left positions... by 1.5...
and same the heights and Top positions by 2.0?? wont all the views fall into place??

YO!han
 
Upvote 0
Top