Android Question Layout Variants

Status
Not open for further replies.

threadw

Member
Licensed User
Longtime User
Hello Everyone,
I have an application which accounts for 2 layout variants one is 360x640 scale 1 160dpi and the other one is 320x569 scale 1 160 dpi the first one is the normalize variant for a 1080x1920 480 dpi and the the last one is for 480x800 240 dpi, my problem is that the app in the 480dpi phone always uses the the layout variant for the 240dpi one, what i'm i missing?

thank you in advance,
 

threadw

Member
Licensed User
Longtime User
hey NJDude thank you for the fast response, i am using the designer scripts to correctly layout how it looks for each variant, perhaps if you could elaborate more , cause i'm really lost.

upload_2016-7-3_13-58-17.png
 
Upvote 0

threadw

Member
Licensed User
Longtime User
For anyone that might be in the position i was regarding this topic, which i did not quite understand the designer script very well, when NJDude tells me to use the scripts this is what he actually means:

Create just one base layout for your application and in the general script of the designer , lay out your entire design based on percentages of X and Y and using the help of anchors were needed, by doing this you'll make sure that your application will be consistent across different screen sizes and resolutions.

upload_2016-7-4_17-23-18.png


Hope this serves as some guidance for newcomers.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
If you have only a portrait or landscape orientation, otherwise...?

Try 2 layouts, 1 portrait e 1 landscape, and set AutoScaleRate(1). This is not the best choice, you should create different layouts (and project code) for big and smal screens (tablet and phones) but you will obtain the same "behavior" than using percentages but with one script line only.
 
Last edited:
Upvote 0

threadw

Member
Licensed User
Longtime User
LucaMs,

Are you referring to layout variants or layout as in design? if it is the first then let me tell you that i tried 2 layouts and coded for each one as explained in my first post, the result in the emulator was fantastic ,each layout variant look beautifully, but not so much when tested on the real device, i did solve my problem by using the method above.

now when talking about layout in the sense of the design i do have 1 landscape layout and one portrait layout which i load according to screen orientation, but the main point been that the layout for portrait is one adaptive layout for all screen sizes and resolution in portrait mode as model in my script as is the landscape layout for all displays in landscape mode, so you see instead of having 2,3 or 4 layouts for different screens plus the code to properly handle them multiply that by 2 if you account for a portrait and a landscape for each screen size that you target.

So in my particular case i believe that the designer script approach is more efficient and uses less code and is much more cleaner to maintain. Hope it clarifies the point explained here.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Where this gets difficult: We supply the user with more or less information DEPENDING ON SCREEN SIZE. Larger screens get more information.
Fortunately I found recently I can us if statements in designer scripts and make things visible or not if there is room.
 
Upvote 0
Status
Not open for further replies.
Top