How can I customize the landscape layout for tablets only?

Imagine I have a layout folder called layout-port . This layout contains two layouts that you can see in the figure below (handset). On the other hand, I have a layout folder, which is used when the screen orientation is not in portrait mode, therefore in the landscape.

enter image description here

However, when I rotate the device using a small screen, it will use the portrait layout, but since the screen is so small, it is not optimal and does not look very good, since the layout of the two fragments is mainly focused on atleast 600dp tablets.

So the question is, can I use the qualifier to set the terrain layout for the smallest width above 600?

I checked the docs http://developer.android.com/guide/practices/screens_support.html , but it doesn't seem to be able to combine the smallest width and orientation.

+6
source share
3 answers

Place the tablet layout in res/layout-w600dp or whatever minimum width you want to support for the two panels.

+5
source

I think you really want to declare a folder ...

 layout-w600dp-land 

this will only be called if your tablet or w600dp is in landscape mode. Basically, you can combine w600dp qualifiers with land .

+5
source

You can simply ignore the -port qualifier. Usually, if the device has 600dp (or any other number you choose), you can display a two-pane layout. Does it really matter if it is in landscape mode or portrait, if there is enough space on the screen?

So, you can place the layout for small screens in the layout folder and use layout-sw600dp for a larger layout.

+1
source

Source: https://habr.com/ru/post/953425/


All Articles