Android Question Compare AutoScaleRate vs Manual Scale

ArminKH

Well-Known Member
hi
before using Designer and Autoscaleall and autoscalerate i use this code to set my viewes size and position
B4X:
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
 

Erel

B4X founder
Staff member
Licensed User
Longtime 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.
 
Upvote 0

ArminKH

Well-Known Member
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.
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?
 
Upvote 0
Top