The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.

Inspecting Layouts

Layouts get complicated. Not only might you be pulling in from several sources (via fragments or <include> or whatever), but you make changes to the contents of the UI at runtime. What you have in your layout resources is a starting point, but only that. Sometimes, it would be helpful to see exactly what is in the UI of your app right now, based on what you have done inside that app.

Launching the Layout Inspector

First, get a debuggable build of your app running on your chosen device or emulator, with the desired activity in the foreground, in the state that you are interested in. Layout Inspector captures a snapshot of the state; it does not continuously update as the UI changes. Hence, you need to get the UI into the state that you want to inspect first.

Then, choose Tools > Layout Inspector from the Android Studio main menu.

Viewing the View Hierarchy

The preview of this section is en route to Mars.

Inspections and Captures

The preview of this section was whisked away by a shark-infested tornado.