The article is reproduced prohibited for commercial purposes, and cannot be accompanied by virtual currency, points, registration and other additional conditions. Reprint shall be marked by the provenance Mulgore grassland and author @jiongbull.
Android screen adaptation scheme
Statistical analysis 1. 2014q1 Active Android Device stats
Parameter table:
Model |
resolution |
pixel density |
Screen Width |
Samsung Galaxy Note2 |
720 * |
xhdpi |
360DP |
Samsung Galaxy S3 |
720 * |
xhdpi |
360DP |
Millet mobile phone 2S |
720 * |
xhdpi |
360DP |
Samsung Galaxy S4 |
1080 * 1920x1080 |
xxhdpi |
360DP |
Samsung Galaxy S2 |
480 * + |
hdpi |
320DP |
Samsung Galaxy Note |
800 * |
xhdpi |
400DP |
Samsung Galaxy Note3 |
1080 * 1920x1080 |
xxhdpi |
360DP |
Red Rice mobile phone |
720 * |
xhdpi |
360DP |
Millet mobile phone 1S |
720 * |
xhdpi |
360DP |
Samsung Galaxy Ace |
480 * + |
hdpi |
320DP |
Millet mobile phone M2 |
720 * |
xhdpi |
360DP |
Millet mobile phone M3 |
1080 * 1920x1080 |
xxhdpi |
360DP |
Millet mobile phone M1 |
480 * 854 |
hdpi |
320DP |
Millet mobile phone 2A |
720 * |
xhdpi |
360DP |
Samsung gt-s7568 |
480 * + |
hdpi |
320DP |
Huawei G520 |
480 * 854 |
hdpi |
320DP |
Samsung Galaxy Mega 5.8 |
540 * 960 |
hdpi |
360DP |
Samsung gt-s7562 |
480 * + |
hdpi |
320DP |
oppo r821t |
480 * + |
hdpi |
320DP |
Huawei C8815 |
540 * 960 |
hdpi |
360dp |
Conclusion: the screen width of most models is 320DP and 360DP.
2.2014Android Operating System trends
Conclusion:the operating system of 4.0 and above occupies more than 90% of the market share.
Scenario 1. Declaring the minimum operating system version supported by the client
- Filtering out older versions of the operating system helps us reduce the amount of work that is required for time-of-model adaptation
- New features Available with Android 3.2 (API level 13) can be adapted to different screens using the width of the screen
<uses-sdk android:minsdkversion= "/>"
2. Declare screen orientation as vertical screen
Avoid page layout Confusion when users cross screen.
android:screenorientation= "Portrait"
3. Layout
For mobile devices, use a set of layout resources, the layout of the size, color, text and other resources using reference values.
Res/layout/name.xml
4. Dimensions
Refer to the Parameters table in the statistical analysis, the VALUES-W320DP directory in the properties of the screen width of 320DP models, the VALUES-W360DP directory of the properties to adapt to the screen width of 360DP models.
Res/values-w320dp/dimens.xml
Res/values-w360dp/dimens.xml
5. Picture
- If you can avoid using bitmaps Do not use bitmaps, which can save space resources and improve the performance of the application
- You can use XML drawings instead of bitmaps, such as rounded rectangles, color maps plotted with XML save space resources, and can be automatically adapted
- using 9-patch,9-patch can be scaled, we can use very small 9-patch to populate very large UI controls, save space resources, improve application performance
- Minimize the layout level of the XML, reduce the layout hierarchy to reduce the work done by the system parsing code, make the interface render faster
- Using merge instead of include, use merge to reduce the effect of the layout hierarchy
- use Relativelayout as much as possible, The hierarchy of layouts can be reduced by using relativelayout compared to multiple linearlayout
-
pixel density |
coefficient |
logo resolution |
hdpi |
1.5 |
72 * 72 |
xhdpi |
2.0 |
96 * 96 |
xxhdpi |
3.0 |
144 * 144 |
Android screen adaptation scheme