Earlier chapters presented aids for creating dynamic and efficient layouts. The tools can make your UI good, but you’ll probably need to do some additional work to make your UI great. This chapter discusses the various tools that help you improve the efficiency of your interface code. I will show you how to use the tools to eliminate:
Slow or jittery redraw rates
A nonresponsive, poorly performing UI
In addition to the content covered in Chapter 11, there are a few concepts relating to how Android builds user interfaces that are important to understand.
When an activity gets started, it asks the framework to draw its UI from its layout definitions. The UI is drawn by walking the View tree and rendering each ViewGroup. Then each ViewGroup requests each of its children to be drawn until all Views in the hierarchy have been rendered. The tree is traversed in order, which means that parents are drawn before their children, with the final order determined by where they appear in the tree.
The runtime draws the layout through a two-pass process via the View tree, visualized in Figure 13-1. For each View rendering, the system must perform two operations: a measure pass and a layout pass. The measure pass collects dimension specifications and the layout pass positions the Views on the screen.
This pass traverses the entire View tree to determine ...