Bitmaps, sizing & best practices

ptarlow

Member
Licensed User
Longtime User
I'm looking for some guidance on layout best practices when it comes to designing for multiple screen sizes. Specifically how to design for and manage things like bitmap scaling verses margin, etc.

I've read Google's Android reference on screen size, pixel density, etc - I'm looking for something with more practical examples and strategies.

Thanks in advance for any help.

Paul
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Just some tips:
- You can create several 'variants' for your layout with the designer: http://www.b4x.com/forum/basic4andr...2-guess-my-number-visual-designer-events.html
- When you call Activity.LoadLayout the most suitable variant is loaded.
This method also returns a LayoutValues object which holds the values of the loaded variant.
You can call GetDeviceLayoutValues to find the current device layout values:
B4X:
    Dim lv As LayoutValues 
    lv = Activity.LoadLayout("1") 'layout values of the loaded variant
    
    lv = GetDeviceLayoutValues 'Current device layout values.

- Use dip units for "pixels length". For example: Button1.Width = 100dip
- You can also use %x and %y units.
 
Upvote 0

ptarlow

Member
Licensed User
Longtime User
Thanks Erel. Between developing truly great software and answering everyone's questions do you ever actually sleep?

:)
 
Upvote 0
Top