Yesterday received a telephone interview, talk about the optimization of Android development problems, the answer is not very satisfactory. It is now recorded as follows:
1. Using Layout files
For example: With ScrollView, ListView and Fragment, notice ScrollView and ListView Nested use of time, will be problematic, see this article in detail: http://www.cnblogs.com/asijack/p/ 4282997.html
2. Using folders
You can put different pictures, strings, layout files, shapes, colors and other resources in different folders
Can be seen in 400, 600,800DP file is not bools.xml, for large screen, the system will automatically from the high screen to low screen search, such as a device 600DP, if not VALUES-SW600DP inside will search VALUES-SW400DP inside and so on. Note: 600DP (600/160=3.75 inches) 160dp=1 inches. 320dp=2 inches. Dp=dip.
There are a lot of other uses.
For example, your XML layout solves this problem with the specified system directory name.
For example, the LAYOUT-SW360DP directory can match a machine with a target width of 360DP. If you want to support the layout switch, you can use the following directory:
Layout-sw360dp-land
Layout-sw360dp-port
If it is a multi-lingual language, such as a user speaking Arabic? Then change the layout name to look like this:
Layout-sw360dp-land
Layout-sw360dp-port
Layout-sw360dp-land-ar
Layout-sw360dp-port-ar
The first two can be used in all languages,-ar on behalf of Arabic.
More similar examples are listed below:
XXX//Example: No directory name added: Default-for Nexus One,droid 2,S2
XXX-SW360DP//Larger cell phone –galaxy Nexus, S3, S4
XXX-SW600DP//7〃 tablet
XXX-SW720DP//10 "flat panel
There are some differences in the Kindle device, as follows:
XXX-LARGE-MDPI//Kindle Fire 7〃
XXX-LARGE-HDPI//Kindle Fire 7〃HD
3, let the white space larger than the image space, so that the image space is larger than the size of the button (in the expanded space to add blank).
4, try to use the Android Studio tool bar, powerful UI editing, but also easy to choose a different screen size for testing.
5, do not put all the pictures are scaled. Conceptually, a simple way to do this is to create a complete set of picture catalogs and match them to many drawable catalogs.
drawable-sw600dp-ldpi
drawable-sw600dp-mdpi
drawable-sw600dp-hdpi
drawable-sw600dp-xhdpi
drawable-sw600dp-xxhdpi
Similar to. In general there are drawble-ldpi, drawable-hdpi and other directories are sufficient, do not need to add all the circumstances.
6, avoid using bitmaps, such as: Jpg,png (if you want to use the best optimization, Pngcrush or imageoption)
7. Drawing with XML
8, multi-use 9 figure
9. Minimize the level of XML layout.
10, with Android Lint. Right-click on the project directory to select Eclipse>android tools>run Lint
11. If you can use relativelayout as much as possible, you can reduce the view level
Optimization issues with Android development