stuck out with Script

YIM bunchhat

Active Member
Licensed User
Longtime User
Hi Android Developers,
My problem is Script how to make my template can use with all screen size (phone and tablet). I have attach my template with for you too, can you show me an example to make it or can you do it for me ask example? Note: I already read forum about script by Erel.:sign0163::sign0163:
View attachment worlde.bal
 

klaus

Expert
Licensed User
Longtime User
You should make a layout for the standard screen size 480 x 320 scale = 1.
And then use AutoScaleAll.
You should play with the AutoScaleRate value for bigger screens.
Have a look at the Beginner's Guide Edition 2.3 chapter 8.10 AutoScale.

Best regards.
 
Upvote 0

YIM bunchhat

Active Member
Licensed User
Longtime User
Ok maybe I should read beginer guid book. But for my Script, I don't have Autoscalerate. I don't know why? my basic4android is licience.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
@Klaus: I am sure he has a version 2.2 or after. If you take a look at his script you will see the word AutoScaleAll commented out.
@YIM: As Klaus instructed you to do, you need to create a layout of: 480x320, then you can use the designer script as follows:
B4X:
AutoScalerate(.5)
AutoScaleAll 
lblAcc.Left = 0%x + 10dip
tlbAcc.Right = 100%x - 10dip
lblcon.HorizontalCenter = 50%x
lblcon.VerticalCenter = 20%y
pnlkey.SetLeftAndRight(0,100%x)
pnlkey.SetTopAndBottom(lblcon.Bottom + 50dip,100%y)
btnFor.Width = pnlkey.Width
btnRev.Width = pnlkey.Width
btnL.SetLeftAndRight(0,((pnlkey.Width/2) - 30dip))
btnR.SetLeftAndRight(((pnlkey.Width/2) + 30dip),100%x)
Try different scale rates, optimum between .2 and .5. When you leave AutoScaleRate out, that means the script uses the default of .3. Experiment with different factors. You should have AutoScaleRate as I am sure you have a version at least 2.2 or after.
J' espere que tout est bien au Cambodge
 
Upvote 0

YIM bunchhat

Active Member
Licensed User
Longtime User
@Klaus and Mahares, I use Basic4andriod version 2.26. I am new with Andriod programming need many help from all of android expert. I will try your Script.
Merci beaucoup, M. Mahares, je pense que vous savez mon pays bien Cambodge.:sign0098:
 
Upvote 0
Top