Android Question Designer - unfortunately... again

LucaMs

Expert
Licensed User
Longtime User
I just wanted to test the scaling of text size, instead I came across this.

A very simple single landscape variant:
upload_2015-12-23_2-14-23.png

EditText1 width is 120dip (25%x) (buttons too, but this is not important, now)


Tested on two devices:
a) Tablet 1280x800-160
b) Phone 480x800-240

Designer
EditText1 W: 120 = 25%x

Tablet (scale 1 - Android 4.42)
AutoScaleRate default...EditText1 W: 176 = 13.75%x
AutoScaleRate 1.........EditText1 W: 302 = 23.59%x


Phone (scale 1.5 - Android 4.04)
AutoScaleRate default...EditText1 W: 180 = 22.5%x
AutoScaleRate 1.........EditText1 W: 180 = 22.5%x
AutoScaleRate 0.5.......EditText1 W: 180 = 22.5%x


Using a ScaleRate of 1 is exactly the same as %x and %y but the texts are scaled according to the physical screensize.

NOTE:
a) using AutoScaleRate(1) I don't get W% = 25%x
b) phone: nothing changes changing AutoScaleRate
c) AutoScaleRate default (0.3): Tablet W% = 23.59%, Phone 22.5%
d) too much difference between default and 1 (tablet): 13.75% and 23.59%

SCRIPT
'All variants script
AutoScaleRate(1) ' changed from default (0.3), 0, 0.5, 1
AutoScaleAll

EditText1.HorizontalCenter = 50%x

Button2.Left = Button1.Right
Button3.Left = Button2.Right
Button4.Left = Button3.Right


upload_2015-12-23_2-30-33.png



[used B4A 5.50 and, fewer tests, 4.30]
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
The UI Cloud is now online.

About the layout, I'm pretty sure that there is no bug here. If you like to further discuss it then start a new thread in the questions forum and upload a small example that demonstrates the problem.

BTW, a scale rate of 1 is similar to %x and %y. It is not exactly the same. As a general rule the scale rate should be smaller than 0.5.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
@LucaMs
Using a ScaleRate of 1 is exactly the same as %x and %y but the texts are scaled according to the physical screensize.
I have never said this for the AutoScale function in the Designer !

When you refer to texts I posted in other threads you must read the whole text.
The text you are refering to is in this post:
Using %x and %y will not affect the text size.
You must define a scale factor depending on the physical sceen size and scale all texts.
Did you have a look at the AutoScale Code Module ?
In this module different equations are used.
Using a ScaleRate of 1 is exactly the same as %x and %y but the texts are scaled according to the physical screensize.

The text refers to the AutoScale module and not to the AutoScale function of the Designer.
Extracting phrases out of their context and letting think that they say something different is not fair!
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
About the layout, I'm pretty sure that there is no bug here. If you like to further discuss it then start a new thread in the questions forum and upload a small example that demonstrates the problem.
You're right, sorry: can you move this thread there? Thanks


As a general rule the scale rate should be smaller than 0.5
I can not understand phrases like these, they seem axioms: can you post the relative source code (C#, I think)?

I have never said this for the AutoScale function in the Designer !

When you refer to texts I posted in other threads you must read the whole text
Sorry, Klaus. I remember having read sentences like this in many posts and looking "at flight", I found this first. In many posts I've read that set AutoScaleRate to 1 is equivalent to using percentages.


a) using AutoScaleRate(1) I don't get W% = 25%x
Tablet W% = 23.59%
It means I lose 1.41%, 13 pixels.

Phone (scale 1.5 - Android 4.04)
AutoScaleRate default...EditText1 W: 180 = 22.5%x
AutoScaleRate 1.........EditText1 W: 180 = 22.5%x
AutoScaleRate 0.5.......EditText1 W: 180 = 22.5%x
This is incredible, or not?

and upload a small example that demonstrates the problem.
It is so simple that I have not thought to attach the project but I posted the simple script.


Thank you both
 

Attachments

  • Scaling.zip
    8 KB · Views: 236
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
can you post the relative source code (C#, I think)?
No. This is internal code.

The purpose of auto scale is to slightly increase or decrease the views sizes based on the difference between the chosen variant size and the actual screen size (diagonal sizes).
If you want to set the dimensions to specific or exact values then you shouldn't use AutoScaleAll.

As we already discussed this topic several times in the past, I will not do it again. Too busy. Sorry.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The strangest thing is that scaling does not occur in the phone.
The phone normalized resolution is 533x320. This is very close to the variant size (it is even closer if you consider the actual activity size).

If the difference is less than 5% then auto scale doesn't do anything.

You need to use this script if you want to have four buttons that spread equally:
B4X:
Button1.SetLeftAndRight(0, 25%x)
Button2.SetLeftAndRight(25%x, 50%x)
Button3.SetLeftAndRight(50%x, 75%x)
Button4.SetLeftAndRight(75%x, 100%x)

Auto scale was not designed to stretch layouts.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Auguri Luca! Season Greetings to Everybody!
I use to write scripts in percentile, they adapt better to any resolution.
I have not tested anchor... let's give a try on next pjt...

Auguri anche a te.

I'm not sure that percentages are the solution. I used them, I also wrote a code module to create commands to set dimensions and positions in percentage, but I understand that problem is the different ratio of displays.


It is impossible to help you if you are not reading my answers...

See the sentence marked as bold in post #5.

BTW, it is an optional feature. You are not forced to use it.
Unfortunately, I read your answer (this means that I don't understand well o_O <--- stupid man :D).
The purpose of auto scale is to slightly increase or decrease the views sizes based on the difference between the chosen variant size and the actual screen size
For me, increase-decrease sizes is same as stretching and scaling = stretching.

Anyway, I understand that if you have two rectangles:
a) 1000x500
b) 1000x700
you cannot get the same "look", you should have "blank" spaces around...
(different displays' ratio is the problem).


Thank you
 
Upvote 0
Top