Reputation: 625
I have a tab-layout in my Android app where I have two different designs for mobile vs tablet. I have followed this page to create two different layout files:
Now, when I am using my mobile in landscape, and I open the app, its picking up the layout defined for the tablet(layout-w600dp) instead of the one for mobile(layout). This is causing issues showing the layout defined for tablet showing up in the mobile app.
I have tried by defining the tablet's layout in layout-sw600dp but its not coming up expected in the tablet.
Thanks in advance. Appreciate your time.
Upvotes: 2
Views: 569
Reputation: 625
The correct solution in this case was using layout-sw600dp instead of layout-w600dp.
The layout from layout-w600dp is picked everytime the screenwidth is more than 600dp (including mobile in landscape mode)
Layout from layout-sw600dp is only used when the shortest width is more than 600dp, orientation dosent matter, hence works only for tablets.
Upvotes: 2
Reputation: 812
Make landscape version of your layout res/layout-land/myLayout.xml
and copy content of your original layout into that new file. It will get inflated on landscape orientation.
Upvotes: 1