1. Use LinearLayout and RelativeLayout whenever possible. Do not use absolute layout.
2. Try dip and sp instead of px.
3. provide different layout files and images for different resolutions.
For example:
4. Set multi-resolution support in AndroidMainfest. xml.
Copy codeThe Code is as follows: <supports-screens
Android: largeScreens = "true"
Android: normalScreens = "true"
Android: anyDensity = "true"
Android: smallScreens = "true"/>
To sum up:
1) android: anyDensity = "true", the system will automatically find the corresponding folder Based on the screen density.
2) android: anyDensity = "false"
(1) If the drawable-hdpi, drawable-mdpi, and drawable-ldpi folders have different density representations of the same image resource, the system will load the resources in the drawable_mdpi folder.
(2) If drawable-hpdi contains high-density images and there is no corresponding image resource in the other two folders, the system will load resources in drawable-hdpi.
(3) If drawable-hdpi, drawable-mdpi has image resources, and drawable-ldpi does not have corresponding image resources, the system will load Resources in the drawable-mdpi folder.