title: How can make several different screen configurations map to a small set of layouts without having to duplicate portions of my layout XML?
body: <p>My application shows either a one-pane UI or a two-pane UI depending on the screen configuration. On smaller screens, it should be one-pane both on portrait and landscape. On mid-sized screens (anything with a "smallest width" of 600dp and up), the landscape orientation accomodates the two-pane layout pretty well, but on portrait orientation, it should use the one-pane layout. On larger screens, it should use the two-pane layout on both orientations. I also want to support the 3.2+ style qualifiers (like sw600dp and sw720dp) as well as the older "size bucket" qualifier ("xlarge").</p>
  
  <p>The most direct way to do this is create several different XML layout files, one for each configuration:</p>
  
  <ul>
  <li>res/layout-sw600dp-land/main.xml</li>
  <li>res/layout-sw600dp-port/main.xml</li>
  <li>res/layout-sw720dp-land/main.xml</li>
  <li>res/layout-sw720dp-port/main.xml</li>
  <li>res/layout-xlarge-port/main.xml</li>
  <li>res/layout-xlarge-land/main.xml</li>
  <li>res/layout-port/main.xml</li>
  <li>res/layout/main.xml</li>
  </ul>
  
  <p>As a result, there's a lot of code duplication in these 8 XML files which essentially describe only two distinct layouts.</p>
  
  <p>How can I do this without having to maintain all these duplicate XML files, which are a maintenance headache?</p>