I have an Activity A which has 2 types of layout. Phones have a single layout and tablets have a Master-Detail layout. The Master-Detail layout is for 7 inch landscape and 10 inch tablets. I have used following layout qualifiers:
-layout - for phones
-layout-sw720dp - for 10 inch tablet
-layout-w820dp-land - for 7 inch tablet landscape
-layout-h820dp - for 7 inch tablet portrait
Untill now everything is working fine.
The problem:
Now I want the activity to work only in portrait mode for phones and in both orientation in 7 and 10 inch tablets and for that I have used the below resources and size qualifiers from this link https://stackoverflow.com/a/14793611/373889
for res/values
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="portrait_only">true</bool>
</resources>
for res/values-sw720dp
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="portrait_only">false</bool>
</resources>
for res/values-w820dp-land
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="portrait_only">false</bool>
</resources>
for res/values-h820dp
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="portrait_only">false</bool>
</resources>
Now the issue is, in the 7 inch tablet, if started in portrait mode, shows normal phone layout in both orientation and if started in landscape mode, shows Master-Detail layout in both orientation. It is not working as it should work. The phones are working fine with normal layout and 10 inch tablet working fine with Master-Detail layout in both direction.
Please let me know if there is something wrong with this approach. Thank you.