I was fighting with exactly! same problem and finally found a solution, so even if question is quite old, maybe someone find it useful
put portrait layout into /res/layout/abc.xml
(you already have it)
put landscape layout into /res/layout/abc_land.xml
create file layout.xml
with content
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="abc" type="layout">@layout/abc_land</item>
</resources>
copy this file into your /res/values-land/
and /res/values-xlarge/
directories
Important is, that your layout.xml
file contain reference to improved (landscape) file abc_land.xml
, that is stored also in layout
directory and also files are under values-x
directories, not layout-x
once.
Also I tried to put into layout directory two files abc_land.xml
and abc_port.xml
and create on them alias from /res/values-land/
, /res/values-port/
and also /res/values-xlarge/
directories, and seems to work, so it's also usable solution to make in layouts some "order"!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…