Android Question a super beginner question...

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
this may be the ultimate noob question but i just have to ask it -

i am writing some code, have 2 or 3 forms (views)
the issues is how do i do it so it will fit all devices and screens ?
on one device it is centered very nicely but on another to much to the right or to the left
i am using AutoScaleAll in each view but it is not really doing it as the justification varies.
i see your sample guys that are so beautifully arranged on the screen and i want to learn how did you do it ?

any one can give a brief explanation ?
a short sample & simple project will be very appreciated

thanks
 

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
firstly - thanks.
i dob't want to center a button
i want the entire screen to fit into the screen as i designed it in the designer
but this goes for one device, how do i make it fit to ANY device keeping the same design ?
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
i have a textbox
i design it to be on the left side of the screen
next to it on the right there is a label
now i run it on the device i used on the designer - all look perfect
i now use another device - larger screen
both elements are scaling but the basic design is not really kept
so on the first device it is fine as i made it, but on the secont one it looks "Yach"
hope i made myself clear
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You need to first decide how do you want your layout to change with larger screens. Maybe the textbox needs to be anchored to both sides and the label should be anchored to the right. This means that the label will move to the right and the textbox will become wider.

Another option is to put all the layout in a panel with a fixed size and use the code I posted post #2 to center the panel. This way your layout will not use all the available screen but it will look more or less the same on all devices.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
thanks.
using the panel - tried it but the fields in the panel stays as they were so it is now centered but on a large screen looks very small.
the anchor feature is new to me and i will learn it now.
many thanks!
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Hi zeev, what i understand from your post is that u would like to have a zoom effect so on all device it would look the same.

Even if you would use a 10" tablet the size of the views should take the same space as on a 4" screen correct?

If so u can use anchors (left or right/top or bottom) and then before the autoscaleall put a scalerate of 1.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Hi zeev, what i understand from your post is that u would like to have a zoom effect so on all device it would look the same.

Even if you would use a 10" tablet the size of the views should take the same space as on a 4" screen correct?

If so u can use anchors (left or right/top or bottom) and then before the autoscaleall put a scalerate of 1.

yes Ilan you're right.
i managed to find a way and all is fine but with no anchors, somehow it messed my design so now it is fine.
however i will give a good time to learn this issue
 
Upvote 0
Top