Resolution of Android phones and iOS phones

Source: Internet
Author: User

The current resolution of Android phones is common

1.1 Common resolutions for mobile phones:

4:3
VGA 640*480 (Video Graphics Array)
QVGA 320*240 (Quarter VGA)
HVGA 480*320 (half-size VGA)
SVGA 800*600 (Super VGA)

5:3
WVGA 800*480 (Wide VGA)

16:9
hd       1920*1080 High Definition
qhd    960*540
720p   1280*720  SD
1080p  1920*1080 HD

Cell phone:
iphone 4/4s 960*640 (3:2)
Iphone5 1136*640
Xiaomi 1 854*480 (FWVGA)
Xiaomi 2 1280*720

1.2 Resolution corresponds to DPI
"HVGA mdpi"

"WVGA hdpi"
"FWVGA hdpi"
"QHD hdpi"
"720P xhdpi"
"1080P xxhdpi"

2 Considerations for screen adaptation2.1 Basic Settings

2.1.1androidmanifest.xml Settings

Adding child elements in Menifest

Android:anydensity= "true" when the application is installed on a different density terminal, the program loads the resources in the xxhdpi, xhdpi, hdpi, MDPI, ldpi folders, respectively.

Conversely, if set to False, the app does not automatically look for resources under the folder, even if it has the same resources under the folder:

1) If the drawable-hdpi, drawable-mdpi, drawable-ldpi three folders have a different density of the same picture resource, then the system will load the resources in the DRAWABLE_MDPI folder;

2) If there are high-density images in the drawable-hpdi, the other two folders do not have the corresponding picture resources, then the system will load the resources in the drawable-hdpi, other similar;

3) If there is a picture resource in the drawable-hdpi,drawable-mdpi, drawable-ldpi does not, the system will load the resources in drawable-mdpi, other similar, use the closest density level.

2.1.2 Horizontal Screen vertical screen catalog distinguish

1) drawable

A) drawable-hdpi the picture is applicable to the horizontal screen, but also for the vertical screen;

b) drawable-land-hdpi, when the screen is horizontal screen, and is high density, load the resources of this folder;

c) drawable-port-hdpi, load the resources in this folder when the screen is vertical and high density. The other same.

2) Layout

In the Res directory, the establishment of the Layout-port and Layout-land two directories, respectively, a vertical screen and two horizontal screen layout files, to adapt to the horizontal screen vertical screen automatically switch.

2.2 Multi-screen fit 4 gold principles

1) fill_parent, Wrap_content, Match_parent, and DP should be used to set the control dimensions in the layout file;

Specifically, when setting the values of the view's properties Android:layout_width and Android:layout_height, thewrap_content,match_parent or DP is better than PX, The text size should be defined using the SP .

2) do not appear in the code of the program specific pixel values, defined in the Dimens.xml;

To make the code simple, Android internally uses the PIX to represent the size of the control, but this is based on the current screen. To accommodate multiple screens, Android recommends that developers not use specific pixels to represent the size of the control.

3) do not use Absolutelayout (android1.5 is obsolete), you can use relativelayout substitution;

4) provide a suitable size picture for different screens.

Different size of the screen with different size of the picture, Low:medium:high:extra-high picture size ratio of 3:4:6:8; For example, for medium density (medium) screen your picture pixel size is 48x48, then low density The picture size of the screen should be 36x36, and the height (high) is 72x72,extra-high for 96x96.

2.3 Using 9-patch PNG images

When using the picture resource, if there is a stretch, because the picture processing reason, will deform, cause the interface shape. The 9-patchpng image is also a standard PGN image, vacated by a pixel interval around the native PNG image, to identify which parts of the PNG picture can be stretched, which cannot be stretched, the border position on the background, and so on.

"Top, left" defines an extruded area

"Right, bottom" defines the display area, and if you use a full-filled background map, it is recommended that you do not set the margin by android:padding, but by 9-patch way.

ANDROIDSDK provides tools for editing 9-patch images, Draw9patch.bat in the tools directory to instantly see an edited stretch, or edit directly with other image editing tools, but no effect is visible.

2.4 Different layout

Android phone screen size is different, there are 480x320, 640x360, 800x480 ...

How can application automatically adapt to different screens?

In fact, it is very simple, just need to create a different layout folder in the Res directory, such as: layout-640x360, layout-800x480 ... All layout files are written to R.java after compilation, and the system uses the appropriate layout according to the size of the screen.

2.5 Test Verification

In general, using AVD Manager to create a number of different sizes of the simulator, if the conditions are available, you can also directly use the real machine test, this is more reliable.

3 References

http://blog.csdn.net/guozh/article/details/8954994

Http://my.eoe.cn/cainiao1/archive/2348.html (Captain Real)

The resolution of iOS (that is, the resolution of the iphone screen, the main screen parameter), is a hardware-related parameter, such as Iphone3 before the screen resolution is 320x480, starting from iphone4 for 640x960 this with the development of the iOS SDK version (3.0, 3.2, 4.0, 4.2, 4.3.0, 5.0, 5.1) and so on, it doesn't matter.

Deployment Target iOS SDK simulator version

All say do iOS development than Android worry, then how does iOS do this? Let's analyze it today and hope to be a little help to the students who do iOS interface design.

1 resolution of iOS devices

iOS devices, there are currently 3 main types (Apple TV, etc. not discussed here), divided into two categories by resolution

iphone/ipod Touch

Pu resolution 320 pixels x 480 pixels

Retina resolution 640 pixels x 960 pixels

ipad,ipad2/new IPad

Pu 768 pixels x 1024 pixels

Retina screen 1536 pixels x 2048 pixels

2 The relationship between the point and resolution used in iOS design

Despite the 4 resolutions listed above, but careful people will find that the resolution of the retina screen is always maintained at twice times the Pu, this is for iOS design or development time to provide a great convenience, naturally think for the interface design, only need to design a set, Then zoom in and out in equal proportion. When it comes to design and development, it is true that Apple, in order to prevent the confusion of thinking in the communication process (especially for programming implementations), uses a point to describe the size of the interface elements, such as:

iphone/ipod Touch

Interface description 320 points x 480 points

Iphone/ipad

Interface description 768 points x 1024 points

Conversion Relationship

Pu 1 points = 1 pixels

Retina Screen 1 dots = 2 pixels

Thus, whether we are designing and developing for Pu or retina screens, we can clearly and uniformly use points to describe the size of the interface elements.

3 Name of the iOS interface picture

Now we can describe the size of the interface elements of the two screens in a unified language, but how do we set up the different resolutions for different screen images? Does it mean that we have to do it in the place where every picture is loaded, add a statement that determines if the current device is a Retina screen, and then load the corresponding picture? Of course you can do this, but iOS has a simpler way of automatically loading, which is named after the canonical file name. For example, the following statement that loads a picture:

[UIImage imagenamed:@ "pic.png"]

In the actual operation, if you find that the current device is a Retina screen, will automatically find the picture "[email protected]", automatically load the image material for the retina screen, is not very convenient?

Therefore, we in the production of iOS devices, you can imitate the following, the image file classification, for the 640x960 folder picture, file name add "@2x" can.

4 Naming conventions for common icons for iOS apps

You can refer to the following two documents:

Apple's q&ahttps://developer.apple.com/library/ios/on this issue #documentation/userexperience/conceptual/mobilehig/ Iconsimages/iconsimages.htm

Apple's official documentation https://developer.apple.com/library/ios/#qa/qa1686/_index.html

Be sure to name the icons according to the specifications described in the documentation!!

PS: Some additional icons refer to

A icon will automatically add a highlight effect, if not required, you can explicitly specify the Uiprerenderedicon key value in the plist to remove

B 57 Pixel Pu iphone icon with rounded corner radius of 10 pixels

C 114 Pixel Retina iphone icon with rounded corners radius of 20 pixels

D 512 pixels for itunes/appstore icons, in actual display will be scaled to 175 pixels for display (but submission is not available to submit 175 pixels)

E 72-megapixel Pu ipad icon with a radius of 13 pixels for the fillet of the icon

F 144 Pixel Retina screen ipad icon with a radius of 26 pixels for the rounded corners

G50 pixels | The final visual size of the ipad's Spotlight search icon is 48 pixels, because iOS removes 1 pixels from each edge of the icon, adding a shadow effect

The final visual size of the spotlight search icon for the H 100 pixel retina screen is 96 pixels, the same reason, this time minus 2 pixels per side

Source: http://www.cnblogs.com/BigPolarBear/archive/2012/03/26/2417777.html

is to show more clarity on the iphone4 ...



Because Phone4 uses a screen called retina, the size is as big as the old iphone, but the resolution is 4 times times higher, and looking at the high-definition diagram, it's too much to see the dots at all.
For the old app, running in iphone4, will automatically replace the original pixel with 4 pixels, so that you do not have to change the code, so that the old app can naturally run in iphone4, but the effect of the UI will be somewhat misty, not the best effect, to achieve the best, You must redesign a 640*960 HD version for the original picture resource to achieve the best UI effect within the iphone4 ~

Therefore, only with the same name of the high-definition image plus @2x this suffix, with uiimage imagenamed This function call Picture name (without @2x), will automatically help you to call the appropriate picture, easy to use.

Resolution of Android phones and iOS phones

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.