layout variants and designer scripts

Cor

Active Member
Licensed User
Longtime User
I have 1 layout 480x320 scale 1

I use the designer scripts to adjust the views.

All runs well with the abstract designer and the choosen variants
Does this means i do not have to add another layout variant

Does it runs automatically correct on all devices?

I have tested it on 1 device 320x240 and it runs ok.

thanks
 

iTzCorky

Member
Licensed User
Longtime User
I always like to test on bigger screens first and then test on the smaller ones. Vice versa some people like to test on the smallest first and then the biggest. If you are like me which most are not you will design a layout for each screen resolution. To answer your question as long as you used the designer scripts correctly and used density pixels (dip) you should be fine.
 
Upvote 0

Cor

Active Member
Licensed User
Longtime User
Thanks,

Normely a device will check the layout variants with the xml file

But now i have only one, does the device always show even i have 1 layout variant
 
Upvote 0

johnb4a

Member
Licensed User
Longtime User
hi,

Can any one help me please with resizing of widget as per different layout varients.
I have tried a lot but could't do it. I have a widget with 1 panel and 1 label. how can i resize it as per different layout varients.
Please help me with an example if possible.
This is how my widget looks..
 

Attachments

  • img.jpg
    img.jpg
    15.1 KB · Views: 249
Upvote 0

iTzCorky

Member
Licensed User
Longtime User
Thanks,

Normely a device will check the layout variants with the xml file

But now i have only one, does the device always show even i have 1 layout variant

Hey Cor using the designer scripts will help a lot in your case, when using the designer script make sure that you use the variant specified script as well for specific sizes, for example when jumping from a phone to a tablet you would want to use the variant specified script, that is how I would do it.
 
Upvote 0

iTzCorky

Member
Licensed User
Longtime User
hi,

Can any one help me please with resizing of widget as per different layout varients.
I have tried a lot but could't do it. I have a widget with 1 panel and 1 label. how can i resize it as per different layout varients.
Please help me with an example if possible.
This is how my widget looks..

Hey john in order to resize the widget the way you want is to use the designer script. Go into the designer and you will see the designer script. If I wanted to resize it just to have the lbl fit across the screen on all layouts I would go into the designer script and add this code:

B4X:
'All variants script
lbl.Width = 100%x

But to go all out to make sure everything was correct I would make sure that the panel was adjusted for as well so the whole code would look like this:

B4X:
'All variants script
Panel1.Width = 100%x
Panel1.Height = 100%y
lbl.Width = 100%x

By doing this you are making the width and height of the panel 100% across all variants and making the just the width of the label 100% across all variants. If you have any more questions feel free to ask.
 
Upvote 0

johnb4a

Member
Licensed User
Longtime User
hi iTzCorky,

I have set the required paraments for panel and label in the designer script as

Panel1.Width = 94%x
lbl.Width = Panel1.Width - 11dip
layout variant is 320x480

It works perfectly when i test it on designer under designer script (F5) by changing layouts in abstract designer. The view size changes as per the screen sizes.
But wen i test it on device (phone 720x1280) the widget takes the size set manually on abstract designer i.e. the width and height.

what may be the problem.
 
Upvote 0
Top