Search code examples
androidandroid-studioandroid-layouttabletlandscape-portrait

Android Studio: multiple layouts, specifically landscape tablet


I am creating an application for a school project within Android Studio. I am required to make the application run on both phones and tablets in both landscape and portrait modes. I have created 3 different layouts for my homepage by opening the Design View and selecting Create XXXX Variation from the Orientation For Preview Section. So now I have a variation for portrait phone, landscape phone, and tablet but I still need one for landscape tablet. I noticed there is a Create Other Variation but I am not exactly sure how I would go about setting that to landscape tablet. Any advice is appreciated

For reference, here is what my layout folder looks like with my different variations.

enter image description here


Solution

  • Click Create Other.. Select Orientation from Available Qualifiers box. Click >> button. In Screen Orientation select Landscape. In directory name paste this : layout-sw600dp-land

    A new folder will be created with the same name having activity_main.xml in sw600dp(tablet 7" size) in landscape mode. Configure as per your requirement.