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"