Android Question layout drawn in designer, and relative % objects position

vangogh

Active Member
Licensed User
Longtime User
HI

When I draw my layout using the designer, I use "absolute coordinates position" (as the designer does)

e.g. myLabet has coordinates, Left=15, Top=15, Width=330, Height=60

then I have to adapt to every device, so in the code I use % coords, so for example

coords in %:
MyLabel.SetLayout(5%x, 3%y, 90%x, 10%y)

I do this for every view (object) I have in my panel.

What am I doing wrong?
Is it the right way to design and put views on my screen?

Thank you
 

Attachments

  • example.jpg
    example.jpg
    245 KB · Views: 52

vangogh

Active Member
Licensed User
Longtime User
Thank you, but still too mutch inaccurate.
If I have to put a label in the center, I need to think in 50%, not in absolute coords, and the designer doesn't allow to use %

as you can see in my attached image, the anchor are harder to be used e.g. for the "middle views", say lblScritta1
ok orizontal hanhor, but what about vertical? it should be 25%x
or the bottom lstviews... width should be= 50%x-10dip

I am looking what the autoscaleall can do
 

Attachments

  • Image1.jpg
    Image1.jpg
    287.1 KB · Views: 48
Last edited:
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
yes LucaMs, thank you. I am doing all by code. boring but it works ;-)

It seems that there isn't a smarter way.

thank you
 
Last edited:
Upvote 0
Top