Example code and application for Huyen Tue Dao's talk on optimizing Android layouts.
The launch screen of the application displays a list of examples for each section of the talk. Each section represents an individual tool or topic for layout optimization.
- Hierarchy Viewer: a complex layout containing several examples of
ViewsandViewGroupsthat could be optimized and that help demonstrate the use of the SDK Hierarchy Viewer. - Lint warnings: XML layouts that cause Lint warnings and that should generally be fixed when found.
- Attributes: examples of using attributes/methods to consolidate multiple
Viewsinto a singleView. - Simpler Views: examples of both using both Android features and selecting the most appropriate layout to reduce number of
Viewsand flatten hierarchies. - Custom
ViewGroup: example of using a customViewGroupto bypass double-layout passes from platform layouts such as theRelativeLayout. This example basically re-implements the launch screen (which usesRelativeLayoutinstances for each list item) with a customViewGroup. Some of the code in theCustomListItemwas taken from Sriram Ramani's Custom ViewGroups.
- Document code examples to distinguish the "bad practice" from the "good practice".
- Finish implementing a fixed version of the "Hierarchy Viewer" layout.
- Add back in the examples for inflation and
ViewStub.