Using configuration qualifiers – mini app
Create a new project and call it Configuration Qualifiers and follow the next steps:
- Right-click on the
resfolder in the project explorer and navigate to New | Android resource directory. Typelayout-landand click on OK.Tip
If you don't see your new directory in the project explorer, you need to change the view of the project explorer through its drop-down selector at the top of the project explorer window. Click on the drop-down selector and choose Project.
- In the
layout_main.xmlfile, change the text of the default TextView widget fromHello worldtoHello portrait!. - Right-click on the
layout-landfolder and navigate to New | Layout resource. Name the filelayout_main.xml. Add a single Plain TextView widget and change thetextproperty toHello landscape!. - Run the app and rotate the device between landscape and portrait orientations. Note that the OS automatically uses the appropriate version of
layout_main.xml.
If we got a reference to...