These points, not a pit, but it really wasted some of my time
1, ScrollView High set into "wrap_content" will shrink very small,
Only one view within the ScrollView is allowed, and do not set his height to "wrap_content", otherwise it will shrink to a very short look.
The ListView is the same.
2. If the item in the ListView has a different style, it is best to use getitemviewtype() to distinguish
In fact, the ListView item can be used to control visiable/gone in a single view layout, resulting in different itemview.
However, there are some disadvantages, 1 is the logic of the GetView () method is somewhat complex, 2 is likely to waste some inflate time, because some of the view is to be gone off, must be displayed should not be inflate, Inflate requires IO, and IO is a time-consuming operation. 3 waste of memory, since it is not necessary to display, it should not have this object.
Baseadapter is born with the ability to differentiate Itemview, overriding the Getitemviewtype () method and Getviewtypecount () can be implemented. At the same time in GetView () only need a simple switch-case can handle different itemview.
3. The ImageView does not fit the width first and then fits the height according to the width of the model.
The pit has been trampled two times. Always thought Android was strong enough, but it really didn't do it.
ImageView has many image scaling modes, but there is no pattern that fits the width of the first fit, and then the effect of the height to fit the width . After trying a lot of pattern combinations, understand this point. So to do this, only honestly according to the screen width, calculate the appropriate width of the picture, and then according to the picture of the width and height of the picture to calculate the height, set to iamgeview width and height.
The six holes in Android development: several tips on view