The Hierarchy Viewer application allows you to debug and optimize your user interface. It provides a visual representation of the layout's View hierarchy (the Layout View) and a magnified inspector of the display (the Pixel Perfect View).
To get the Hierarchy Viewer started:
1. Connect your device or launch an emulator.
2. From a terminal, launch hierarchyviewer from your SDK /tools directory.
3. In the window that opens, you'll see a list of Devices. When a device is selected, a list of currently active Windows is displayed on the right. The "focused window" is the window currently in the foreground, and also the default window loaded if you do not select another.
4. Select the window that you'd like to inspect and click Load View Hierarchy. The Layout View will be loaded. You can then load the Pixel Perfect View by clicking the second icon at the bottom-left of the window.
If you've navigated to a different window on the device, press Refresh Windows to refresh the list of available windows on the right.