Questions about Designer Variants, Etc.

rgately

Member
Licensed User
Longtime User
Greeting,

1) How many variants does one need in order to create a layout that looks good in portrait and landscape modes on both cellphones and tablets?

a) Can I use just one variant which could be adjusted later with code to work for all resolutions? If so, what would be the best resolution and scale to use for the variant?

b) Should I use two variants (landscape and portrait) for all resolutions? If so, what would be the best resolutions and scales to use?

c) Should I use four variants (landscape/portrait, small/large resolutions)? If so, what would be the best resolutions and scales to use?

d) Or, what is the simplest way to make a layout look good on all devices, large and small, landscape and portrait?


2) How does Android know which variant to use when the orientation has changed or when the device is large or small? Can someone point me to where this is explained?


I have tried using Designer Scripts and like what it does but I really want to do all the sizing and positioning using the Abstract Designer. I find coding the visual interface to be too tedious and time consuming.

I've read a lot of documentation and tried various examples - but I'm still a little confused. Thanks for any help!
 
Last edited:

NJDude

Expert
Licensed User
Longtime User
My humble opinion,

Answering question #1:

It is better to create your layouts using the Designer Scripts, depending on the complexity of your UI design it might be a little tedious and time consuming, but, it is done only once, in the other hand, creating individual layouts (portrait and landscape) for all/most of the resolutions out there will make your life difficult.

Answering question #2:

Android will choose the "closest" layout for the device, in other words, it will load the layout that will fit better to the current orientation, density, etc, but, the problem with that is that you will need to create every possible combination and that is not a good practice since you will be bloating your app with layouts that will not be used.

Using the designer scripts is not really complicated, you just need to get used to it, if you say you are confused, let me ask you this, where is your confusion?, we can help you out if you give us a clue. :)
 
Upvote 0

rgately

Member
Licensed User
Longtime User
To NJDude - your response was helpful.

So if I use Designer Scripts, does that mean I can't or shouldn't use the Abstract Designer to layout the views? Because Designer Scripts locks out the Abstract Designer, I get the impression that you would want to choose to use one or the other tools to do the layout of views. If so, I'm not pleased with having to give up the visual method of designing layouts.

I don't see why Abstract Designer cannot do what Designer Scripts can do. And I thought that it may be useful to have the Designer Script's new layout properties added to the Properties list in Abstract Designer. Also, I'd like to have them made available from the main code.

If I have to use Designer Scripts in order to make a layout that will fit on all(most) devices then I'll do it.

How do I know when to create new variants?

I assume that the fewest variants I need is 2, because I need one for landscape and another for portrait mode. I also assume that Designer Scripts can make the variants fit well on almost any screen resolution. Are these assumptions correct?

Also, what would be the best variant resolution and scale to create if I was only going to have 2 variants? Is larger like 480x800 better than 320x480?


One of the things that confuses me is understanding how Android determines which variant to use - depending on the device and whether or not it is in landscape of portrait mode.

Your response was helpful but I've noticed that Android doesn't always pick the landscape variant and instead it picks the portrait variant.

If I design a landscape (480x320, scale=1) and a portrait (320x480, scale=1) variants - when I run the code on my 1024x600 device, in landscape mode, the portrait variant is what is displayed - not the landscape variant.

This also happens with a 480x800 Portrait variant being displayed on a smaller device that's in landscape mode.

I don't understand why Android doesn't pick the wider of the 2 variants when it's in landscape mode.

Anyway, thank you for your support, I'll get it eventually.
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
The views are locked in the abstract designer when using the designer scripts because is the script that decides where to place the views and their dimensions, you will have to click the RUN SCRIPT button to see the results.

You are correct in assuming that the minimum number of variants is 2, one for portrait and one for landscape.

Regarding the size and density for your layouts made with the designer scripts, you can use 320x480 scale =1 for portrait and 480x320 scale = 1 for landscape that should be enough.

Try the examples and you will see that is not difficult, an believe me, once you get it you'll realize it's a piece of cake.
 
Last edited:
Upvote 0

rgately

Member
Licensed User
Longtime User
NJDude,

Thanks again. I have tried Designer scripts and have run the scripts to see how they look in Abstract Designer and on my devices. Based upon your feedback, I will focus upon using Designer Scripts again. Like you said it's really not difficult.

Initially, I was disappointed about not being able to use the Abstract Designer for the same purpose - but I can get over that.

One more question...
If Android is supposed to pick the correct variant to use when the device changes orientation then I do not need to select the variant programatically?
 
Upvote 0
Top