Android Question Better knowlege about layout with variants

yfleury

Active Member
Licensed User
Longtime User
I made a layout with 2 variant
One variant landscape 1280 x 800 for tablet
Another variant portrait 320 x 480 for phone

On phone (Oneplus Nord10) the variant for phone in portrait look good, When I turn it in landscape, it look like tablet variant landscape and it look good too

On tablet (galaxy tab A 10.5") it look allways the varient for phone (portrait) and even in landscape or portrait.

Maybe I missing somthing?
 

yfleury

Active Member
Licensed User
Longtime User
The problem is how to choose the layouts for different devices ? This way, it was more difficult to maintain.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I do not really understand the logic of your layout variants.
One layout, landscape, for big screens, tablets. What do you expect when the screen is in portrait.
One layout, portrait, for small screens, phones. And what do you expect when the screen is in landscape.
You could use two layout files as already suggested, check the screen dimension with
DeviceSize = GetDeviceLayoutValues.ApproximateScreenSize
and load the corresponding layout file.
Or post a small project showing the problem.
 
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
Here, a screenshot of two variant.
and 4 photos of 2 devices (portrait and landscape)

By coding, I know how to fix landscape for tablet and portrait for phone. And I can choose different layout for each.
But it will be more difficult to maintain. Is it a way to choose a variant?

I write a small project
 

Attachments

  • phone.png
    phone.png
    13.8 KB · Views: 147
  • TAB.jpg
    TAB.jpg
    21.7 KB · Views: 142
  • phoneLands.png
    phoneLands.png
    282.1 KB · Views: 139
  • phonePortrait.png.jpg
    phonePortrait.png.jpg
    124.3 KB · Views: 142
  • tabLands.jpg
    tabLands.jpg
    186.5 KB · Views: 131
  • tabPortrait.jpg
    tabPortrait.jpg
    176.2 KB · Views: 136
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
Small project.
I create 2 layout, each of them have 2 variant.
LsmallVariantFirst layout have a phone variant on top and a tablet variant under phone one
LBigVariantFirst layout have a tabletvariant on top and a phone variant under tablet

On phone in portrait:
even I load any layout the variant Phone portrait appear on screen.

On phone in landscape:
when i load LsmallVariantFirst layout, it show a phone variant.
when i load LBigVariantFirst layout, it show a tablet variant.

On tablet on any orientation
even I load any layout the variant Phone portrait appear on screen.
 

Attachments

  • layout.zip
    136.5 KB · Views: 174
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
I make a layout with 4 variants
For phone: landscape and portrait
For tablet: landscape and portrait

I try phone variants on top
And I try tablet variants on top to

On any device they show only phone variants on any orientation.
 
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
Ok I upload another small project with a layout and 4 variants.

If I understand well how it work, I can use only a variant for phone or tablet by layout. I have to pay attention on size of view and text size when I create layout to fit all device.

I can choose portrait for phone and landscape for tablet by coding it.
 

Attachments

  • layout.zip
    21.2 KB · Views: 134
Upvote 0
Top