Android screen adaptation

Source: Internet
Author: User

I. Terminology and concepts
Four Screen size categories:: Small, normal, large, and XLarge
Four density classifications: ldpi (Low), MDPI (Medium), hdpi (High), and xhdpi (extra high)
It is important to note that XHDPI is the only category that has been added since Android 2.2 (API level 8).
XLarge is the category that was added from Android 2.3 (API level 9).
DPI is the abbreviation for "dot per inch" and the number of pixels per inch.
General screen: LDPI is 120,mdpi is 160,hdpi is 240,xhdpi is 320. 480
Second, about the layout
1. Do not use absolute layout
2, try to use match_parent instead of fill_parent
3. Use weight layout as far as possible
4, solid color background as far as possible using shape definition or. 9patch production
Three, adaptive screen size
1. Interface layout
5 sets of layouts according to the interface
Layout stores some common layouts that do not change with the size of the screen, such as title, bottom
Layout_small storage screen size less than 3 inches or so of the layout
Layout_normal storage screen size less than 4.5 inches or so of the layout
Layout_large storage screen size about 4-7 inches of layout
Layout_xlarge storage screen size about 7-10 inches of layout
2. Icon Resources
5 sets of picture resources need to be prepared according to the DPI value, drawable,drawalbe-ldpi,drawable-mdpi,drawable-hdpi,drawable-xhdpi
Android has an automatic matching mechanism to select the corresponding layout and picture resources
Iv. about picture Making
1. Design
Design drawings need to design dimensions before, as far as possible to use the current popular screen size, such as the current proportion of the heaviest is the 480 series, 480*800,480*854
The screen level is divided by the screen density, which is not related to pixels. If you want to have density and pixels associated, you need a reference,
Android rules MDPI 160 is a standard reference, which means that 1 densities on 320*480 devices can accommodate a single pixel.
hdpi corresponds to a density of 240, then a density can hold 1.5 pixels
2, transduction
The length of the width is preferably a multiple of 3, the size of the Android log icon 48*48m,72*72h,96*96x
The length of the width of the best is a multiple of 2, because the picture at the time of compression, if it is an odd number may be problematic.
So according to the above two, if the length of the width is a multiple of 6 is the most ideal
3, the icon of the adaptation
Suppose the artist has done the 20*20 design in the resolution of 480*800, if it is necessary to fit 720*1280 how to do?
According to the proportion, their relationship is 2:3, then in the 720*1280 need to design 30*30 diagram, the same xxhdpi on the 40*40 map
4. Icon Directory
480*800 cut down the figure we placed in the DRAWABLE-HDPI directory, according to the 2:3 enlarged icon placed in the DRAWABLE-XHDPI directory,
In the DRAWABLE-XXHDPI directory, follow the twice-fold enlarged icon.

Android screen adaptation

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.