Android screen adaptation solution and android screen adaptation

Source: Internet
Author: User

Android screen adaptation solution and android screen adaptation

RepostDisableIt is used for commercial purposes and cannot carry virtual currency, points, registration, and other additional conditions. The source and author @ JiongBull must be indicated in the reprint.


Android screen adaptation solution

Statistical Analysis 1. Active Android devices

Parameter table:

Model Resolution Pixel density Screen width
Samsung Galaxy Note2 720*1280 Xhdpi 360dp
Samsung Galaxy S3 720*1280 Xhdpi 360dp
Xiaomi Phone 2 S 720*1280 Xhdpi 360dp
Samsung Galaxy S4 1080*1920 Xxhdpi 360dp
Samsung Galaxy S2 480*800 Hdpi 320dp
Samsung Galaxy Note 800*1280 Xhdpi 400dp
Samsung Galaxy Note3 1080*1920 Xxhdpi 360dp
Red mi mobile phone 720*1280 Xhdpi 360dp
Xiaomi mobile phone 1 S 720*1280 Xhdpi 360dp
Samsung Galaxy Ace 480*800 Hdpi 320dp
Xiaomi phone M2 720*1280 Xhdpi 360dp
Xiaomi mobile phone M3 1080*1920 Xxhdpi 360dp
Xiaomi mobile phone M1 480*854 Hdpi 320dp
Xiaomi phone 2A 720*1280 Xhdpi 360dp
Samsung GT-S7568 480*800 Hdpi 320dp
Huawei G520 480*854 Hdpi 320dp
Galaxy Mega 5.8 540*960 Hdpi 360dp
Samsung GT-S7562 480*800 Hdpi 320dp
OPPO R821t 480*800 Hdpi 320dp
Huawei C8815 540*960 Hdpi 360dp

Conclusion: The Screen width of most models is 320dp and 360dp.

2. 2014Android operating system trend

Conclusion: Operating Systems of Version 4.0 and later account for more than 90% of the market share.

Solution 1. Declare the minimum operating system version supported by the client
  • Filters out old operating systems to help reduce the workload caused by time-based adaptation.
  • You can use the new features provided by Android 3.2 (API Level 13) to adapt to different screens based on the screen width.

<Uses-sdk android: minSdkVersion = "15"/>

2. declare that the screen direction is vertical

Avoid page layout disorder when the screen is landscape.

Android: screenOrientation = "portrait"

3. Layout

For mobile devices, use a set of layout resources and reference values for dimensions, colors, texts, and other resources used in the layout.

Res/layout/name. xml

4. Dimensions

According to the parameter table in the statistical analysis, the properties in the values-w320dp directory are applicable to the models whose screen width is 320dp, and the properties in the values-w360dp directory are adapted to models whose screen width is 360dp.

Res/values-w320dp/dimens. xml
Res/values-w360dp/dimens. xml

5. Images
  • If bitmap can be avoided, do not use bitmap, which can save space resources and improve application performance.
  • You can use XML plot instead of bitmap, for example, rounded rectangle. Compared with bitmap, the color map drawn using XML saves space and automatically adapts to the bitmap.
  • 9-patch and 9-patch can be scaled. We can use a small 9-patch to fill a large UI control, saving space resources and improving application performance.
  • Minimize the XML layout level and reduce the layout level to reduce the work done by the system to parse the code and make the interface rendering faster.
  • Use merge instead of include to reduce the layout hierarchy.
  • Try to use RelativeLayout. Using RelativeLayout can reduce the layout level compared to using multiple LinearLayout.
  • Each type of cut graph requires three types shown in the following table
Pixel density Coefficient Logo resolution
Hdpi 1.5 72*72
Xhdpi 2.0 96*96
Xxhdpi 3.0 144*144

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.