Android Qualifiers use "Beginner"

Source: Internet
Author: User

In Android, different screen sizes appear.

In the course of use, it may appear in different forms. For example, phone mode or tablet mode.

To make the same app appear in different screen states, let the app adapt to the screen.

You only need to create a different layout folder in the Res directory.

For example:

Create a new folder " Layout-large" and create a new XML file with the same name as the main layout and activity_main.xml layout-large/activity_main< /c7>

The Layout-large/activity_main layout contains two fragments, the two-page mode. Where large is a qualifier, devices that are thought to be large will automatically load the layout under the Layout-large folder, while small screen devices will still load layouts under the Layout folder.


Screen Features

Qualifier

Describe

Size

Small

Resources available for small-screen devices

Normal

Resources available for medium-screen devices

Large

Resources available to large-screen devices

XLarge

Resources for large-screen devices

Resolution

ldpi

Resources available to low-resolution devices (below 120DPI)

mdpi

Resources available for medium-resolution devices (120dpi to 160dpi)

hdpi

Resources for high-resolution devices (160dpi to 240dpi)

xhdpi

Resources for ultra-high-resolution devices (240dpi to 320dpi)

Direction

Land

Resources available for Horizontal screen devices

Port

Resources available to vertical screen devices

Although these qualifiers can alleviate the adaptive problem of the screen to some extent, it is sometimes difficult to satisfy.

Therefore, the rule with the minimum width qualifier is introduced.

The minimum width qualifier allows us to specify a minimum finger (in DP) for the width of the screen, then a device with a screen width greater than this value will load a layout, and a device with a screen width of less than this value will load another layout.

Create a new LAYOUT-SW600DP folder under the Res directory, and then create a new Activity_main.xml layout under this folder

Android Qualifiers use "Beginner"

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: info-contact@alibabacloud.com 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.