Android Question Module Scale "issues"

Discussion in 'Android Questions' started by LucaMs, Mar 31, 2018.

Tags:
  1. LucaMs

    LucaMs Expert Licensed 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):
    Code:
    Activity.LoadLayout("Lay1")
    '    Scale.Rate = 0.3
        Scale.Initialize

        Scale.ScaleAll(
    ActivityTrue)
    Why Button2 is not placed correctly?
     

    Attached Files:

  2. LucaMs

    LucaMs Expert Licensed User

    In the project I wrote also:
    Code:
    ' *** 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).
     
  3. klaus

    klaus Expert Licensed User

    You should NOT use anchors nor any designer scripts these will alter the scale function.
    SacleAll is the same as %x and %y.
    Remember, the Scale module was written before anchors did exist.
     
    LucaMs likes this.
  4. LucaMs

    LucaMs Expert Licensed User

    Well, I cannot exclude anchors totally; I have reset the default anchors for Button2 (and removed the script for Label1) but now the result is:
    upload_2018-3-31_15-51-55.png

    Code:
    Activity.LoadLayout("Lay1")
    '    Scale.Rate = 0.3
        Scale.Initialize
        Scale.ScaleAll(
    ActivityTrue)
     
    Last edited: Mar 31, 2018
  5. klaus

    klaus Expert Licensed 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.
     
    LucaMs likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice