How to make your layout resize according to your screen resolution?

SCIS

Active Member
Licensed User
Longtime User
Hello community,

My question is, how to make your layout resize according to the screen resolution of the device you're working on? For example: when I run my app on my phone the layout fits perfectly, but when I run it on my tablet, the layout has the same size as on my phone with a load of white space around it. How can I solve this?

Thanks in advance,
SCIS.
 

raytronixsystems

Active Member
Licensed User
Longtime User
Try using view dimensions in terms like (100%x) and (100%y). If you had a panel of a width of 100%x it would be displayed as the exact width of the screen no matter what device you were running on and for height 100%y would do the same. For detecting device orientation if the current width (i.e If Activity.width > Activity.height) then you are in Landscape mode, otherwise you would be in Portrait mode. This subject has been discussed many times here on the forum as well as the Beginner's and User's Guides available as a free download. If you search around you will get even more answers to your question.

You may want to start here: http://www.b4x.com/forum/basic4android-getting-started-tutorials/22522-designer-scripts-autoscale-tutorial.html#post130677

Regards,
Ray
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…