Device rotation, creating a horizontal mode layout--android Studio

Source: Internet
Author: User

1. In the Project Tools window, right-click the Res directory and select the New--android Resource Directory menu item.

2. Select layout from the Resource type resource type list to keep the main option of the source set intact.

3. Select orientation in the list of selected resource features and click the button to move to the selected Resource feature area on the right.

4. Confirm the landscape option for the selected screen orientation drop-down list and make sure the directory name is displayed as Layout-land, click OK to create the Res/layout-land directory.

The-land suffix name here is another example of the configuration modifier used. When the device is in the horizontal direction, Android automatically finds and uses the layout resources under the Res/layout-land directory. In other cases, the Res/layout directory is used by default.

Copy the default file for vertical mode res/layout. XML directly to the Res/layout-land, noting that two files must have the same file name to be referenced with the same resource ID.

Note: The Res/layout-land is not displayed when project is tuned to Android in the upper left corner.

Extension: Save data before device rotation ...

Device rotation, creating a horizontal mode layout--android Studio

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.