views:

588

answers:

2

I've seen references to being able to specify two separate layout xml files for an activity, one for Portrait and one for Landscape. I've not been to find any information on how to do that though. How do I specify for each activity which xml file is it's portrait layout and which is the Landscape layout?

Is it also possible to specify different layouts for different screen sizes? If so, how is this done?

+2  A: 

Create a layout-land directory and put the landscape version of your layout XML file in that directory.

mbaird
Does that mean all activities need to define both a landscape and a portrait view if I do this?
Jay Askren
No, if no layout-land definition exists it just uses the XML layout in the standard layout directory.
mbaird
+3  A: 

You just have to put it under separate folders with different names depending on orientation and resolution, the device will automatically select the right one for its screen settings

More info here:

http://developer.android.com/guide/practices/screens_support.html

under "Resource directory qualifiers for screen size and density"

Silvio Donnini