Android Question Module Scale "issues"

LucaMs

Expert
Licensed User
Longtime User
Probably I forgot how to use the module Scale.

Starting from this example layout (variant 480x320-1):
upload_2018-3-31_15-7-54.png



On my tablet (1280x800-1):
upload_2018-3-31_15-10-25.png


Code used (no scripts):
B4X:
    Activity.LoadLayout("Lay1")
'    Scale.Rate = 0.3
    Scale.Initialize

    Scale.ScaleAll(Activity, True)

Why Button2 is not placed correctly?
 

Attachments

  • ModScaleTest.zip
    14.1 KB · Views: 287

LucaMs

Expert
Licensed User
Longtime User
In the project I wrote also:
B4X:
' *** Code below "works".
    Activity.LoadLayout("Lay2")
    Scale.SetReferenceLayout(1280,800,1)

but this is wrong; it works because I tested the layout on a device with the same resolution and density of the layout. On another device, 800x480-1.5 it looks so:
upload_2018-3-31_15-23-9.png


Note also the strange "color" of buttons (I have not set colors).
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, for an %x and %y scaling, on tablets, you need to set Scale.Rate = 1.
If you use a ScaleRate less than 1 you need to reposition the views.
Or put the layout onto a Panel and center this one.

It's quite some time time that I hadn't have a look the this module.
 
Upvote 0
Top