Autoresizing components

GaNdAlF89

Active Member
Licensed User
Longtime User
Hi, I have a question about the dimension of components in my activity...
Example: I have a label and two buttons, I set their dimensions (height and width) according to dimension of display in my smartphone.
What can I do to make "autoresizeable" the components, so that if I run my app on my tablet, the label and the buttons are proportionate according to new dimensions of display?
 

MLDev

Active Member
Licensed User
Longtime User
You can use %x and %y. e.g. 50%x means 50% of the Activity width and 50%y means 50% of the Activity height.

See "Special functions like 50%x, 50dip" in the beginner's guide.
 
Upvote 0

MLDev

Active Member
Licensed User
Longtime User
This will add a label 1/4 the size of the Activity in the center:

B4X:
Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y)
 
Upvote 0
Top