Android Question Autoscale not working ?

Phayao

Active Member
Licensed User
Longtime User
Hello,

sorry for the stupid question - but after trying half a day I stuck with a strange thing:
I use autoscaleall in the designer script - seems to have no effect on the layout, for example on a smaller tablet as the one I used to develop, the textsizes are far too big and the views are distorted.
When I use autoscale for every single view, it works in the designer - the connected tablet shows everything ok. But when I start the application, the layout is just as before. So I wonder how can it be that the views in the connected designer are fine but in the application not ?
Something I'm doing wrong here obviously ?
 

Cableguy

Expert
Licensed User
Longtime User
The visual designer runs the script on the selected screen size (320*480 by default).. To be sure it runs the screen on your device's screen specs, use the "use connected device screen" option
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Thanks for this reply, you are right of course !
Now this said, I am able to make the designer and the "real" device the same.
One problem remains though: the views are adapted nicely, but the TEXTSIZES do not adapt to the smaller screen, so I had to define the textsizes for each text individually for each screen ?
Sounds strange, according what I read they should be autoscaled as well, isn't that so ?
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Thank you Klaus and Erel,

I'm playing around and now create a simple new project just with labels to see the effects.
You are right, now the textsizes are adapted.
Though strange to me - on a tablet with big screen I adapted everything to look ok, when i switch in the designer to 320x480 then the textsizes are all far too big.
I will attach an example soon, obviously I'm doing some beginners mistake.
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
OK, finally I can see my beginners mistakes: :rolleyes:
(1) I did declare AUTOSCALEALL after the view definitions in the designer -
it has to be in THE FIRST LINE (ok, too lazy to read all the manuals before...:oops: )
(2) It seems to me that the textsize has to be declared in the designer script, like
"lblDate.TextSize = 16", then it will be autoscaled, also when it is programmatically set.
If the textsize is only set in the Main window of the designer it seems not to work, so that is were my confusion came from.

The second point is not clearly mentioned in the tutorials (if I did not overlook it...) and should be stressed.

Thanks for the support and the phantastic B4A ! :D
Chris
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
2) "lblDate.TextSize = 16" No, you don't need to do that.
If you downscale from a big screen to a smaller screen you should use AutoScaleRate(1) or a value close to 1.
Otherwise the scale factor will be too small.
 
Upvote 0
Top