Rudi Kershaw
Rudi Kershaw

Reputation: 13022

Combining layouts in Android

Combining layout-large and layout-land

How can I make my app select a layout xml when the device is both large and in landscape?

I have the following directory structure;

res/layout/basic_layout.xml
res/layout-large/?
res/layout-land/?

Upvotes: 1

Views: 653

Answers (1)

Rudi Kershaw
Rudi Kershaw

Reputation: 13022

You can create folders that are combinations of your required specification. For example you can combine large and landscape folders like so;

res/layout/basic_layout.xml                // Default layout
res/layout-large-land/basic_layout.xml     // Layout for when your on a screen 
                                           // that is at least large *and* landscape.

Note that your layout-large-land layouts will apply to xlarge screens in landscape if you have not also specified a layout-xlarge-land layout. The same can be said of any other combinations such as;

res/layout-small-port

Reference;

Upvotes: 1

Related Questions