I've seen references to being able to specify two separate layout xml files for an activity, one for Portrait and one for Landscape. I've not been to find any information on how to do that though. How do I specify for each activity which xml file is it's portrait layout and which is the Landscape layout?
Is it also possible to specify different layouts for different screen sizes? If so, how is this done?
Android App Development for Beginners Step 3 – Create a layout file by right-clicking on the resources, name the file, from the 'Available qualifiers, select Orientation. Click >> option. Select Landscape from UI mode.
I think the easiest way in the latest Android versions is by going to Design mode of an XML (not Text). Then from the menu, select option - Create Landscape Variation. This will create a landscape xml without any hassle in a few seconds.
Change part of a document to landscape Select the content that you want on a landscape page. Go to Layout, and open the Page Setup dialog box. Select Landscape, and in the Apply to box, choose Selected text.
Choose either landscape (horizontal) or portrait (vertical) orientation for all, or part, of your document. Click PAGE LAYOUT > Orientation. Click Portrait, or Landscape.
Create a layout-land
directory and put the landscape version of your layout XML file in that directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With