Android Question Compare AutoScaleRate vs Manual Scale

Discussion in 'Android Questions' started by ArminKH, Jul 5, 2015.

  1. ArminKH

    ArminKH Well-Known Member

    hi
    before using Designer and Autoscaleall and autoscalerate i use this code to set my viewes size and position
    Code:
    Sub AutoResizeAll
        
    Dim xx,yy,rr As Float
            xx=(((
    100%x)/320)/Density)
            yy=(((
    100%y)/480)/Density)
            rr = 
    Min(xx,yy)
                
    For Each V As View In Activity.GetAllViewsRecursive
                    V.Left=V.Left*rr
                    V.Top=V.Top*rr
                    V.Width=V.Width*rr
                    V.Height=V.Height*rr
                
    Next
    End Sub
    above code works perfectly and my viewes scaled with a good Rate
    but for now if i want to Set Same Scale Rate by using AutoScaleAll from designer then Which Scale Rate must be Entered? 0.5?0.6?0.7?
    i want just same result
    thank u
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Your code is similar to using a scale rate of 1.0. Though auto scale all is more sophisticated than this code.

    It compares the chosen variant size to the actual device size. It doesn't assume that the variant size is 320x480.

    I don't think that it is a good solution to use a scale rate of 1.0. It means that your layout is stretched on large devices. Using anchors together with the default autoscale all will give better results.
     
    ArminKH likes this.
  3. ArminKH

    ArminKH Well-Known Member

    thank u but when i use AutoScaleAll then my viewes are a bit small on large devices
    what do you think about using a Scale Rate between 0.5 and 0.7 ? again layout is stretched on large devices And seem not good?
     
  4. LucaMs

    LucaMs Expert Licensed User

  5. Erel

    Erel Administrator Staff Member Licensed User

    Anchors and designer script are more important than scaling. In most cases the scale rate should be smaller than 0.5.

    Make sure to test the layout on tablets and phones (you can use the UI Cloud for that).
     
    Peter Simpson and NJDude like this.
Loading...