Android Question About displays (6.20,6.40,6.70)

Hello everyone, I have more questions again. One day I'll get good at this, B4X is wonderful. I created a small app, and ran it on my Asus cell phone with a 6.20 screen, and when installing it on another device, a Samsung with a 6.70 screen, the items were a little out of position. How do I solve this in the code?, that is, make it compatible for screens of approximate sizes?. I understand that if it were a tablet, there would be another configuration, but these approximate screens, how to solve it?

In time, the standard resolution in b4x (320x480), which screen measurement is compatible with?, how do I convert this to inches?

Grateful.
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
When I first started working on phone apps I soon discovered that thinking in terms of inches and pixels is not the way to go. Instead you need to think in terms of proportion - eg one third screen height or one quarter screen height. Use %x and %y.

My advice would be to look at other apps and work out how the layout has been designed. You will see that many are split into subsections that use the full screen width. And they leave plenty of room around text. If you use the B4A designer then use anchors to centralise panels. Sometimes - if you really need to put three option buttons across a screen, for instance - then you will have to use code. Doing this with Designer Script is a little easier because you an use Label1.Right and Label1.Bottom and so on.

Finally, although I don't think that this is your problem at the moment, it is rarely possible to design a layout that looks good on both 'phones and tablets; this - unless you want to use both portrait and landscape layouts - is the only time that you should think of using variants.
 
Last edited:
Upvote 0
Top