You can use layout aliases. Instead of describing your layout directly in the XML files for each screen configuration, you should define your two layouts in two XML files, for example, "onepane.xml" and "twopanes.xml". These files go to res / layout.
Now you need to map these layouts to your other screen configuration and where the “alias layout” technique comes in handy. For each combination of screen qualifiers, create an XML file in res / values-X / layout.xml, where X is the combination of qualifiers. In this file, declare a layout resource that points to: @ layout / onepane or @ layout / twopanes, depending on the situation:
RES / values-sw600dp-earth / layout.xml:
<resources> <item name="main" type="layout">@layout/twopanes</item> </resources>
RES / values-sw600dp-port / layout.xml:
<resources> <item name="main" type="layout">@layout/onepane</item> </resources>
Do the same for your other configuration combinations, and this way you can accomplish what you are looking for: you can map two layouts (single-panel and two-position) to several different screen configurations without having to duplicate your layout.
For more information on this, check out the “Multi-Screen Support” lesson in Android Training: http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
source share