Technical docs‎ > ‎

Layout Inspector

The Layout Inspector in Android Studio allows you to inspect your app's view hierarchy at runtime from within the Android Studio IDE. This is particularly useful when your layout is built at runtime rather than being defined entirely in an XML layout.


The Layout Inspector available in Android Studio 2.2 is an early release. It's a work in progress that will supersede the Hierarchy Viewer tool once it is feature complete. For now, it provides a quick solution to inspect the view properties of your layout without leaving the IDE.


To open the Layout Inspector, first launch your app on a connected device or emulator. Then open Android Monitor window, select your device and app process, and then click Layout Inspector . You can also open it by clicking Tools > Android > Layout Inspector in the menu bar.



Layout Inspector currently provides just a snapshot of the layout at the time you open the tool. The left pane shows the view hierarchy as a list, the center pane shows a screenshot of the layout, and the right pane shows all the properties for the selected view.


Clicking a view in the hierarchy list highlights the same view in the screenshot, and vice versa.


If your layout includes overlapping views, then by default, only the view in front is clickable in the screenshot. To make the view behind clickable in the screenshot: Right-click the in-front view in the view hierarchy and uncheck Show in preview.


If you're debugging your app or simply interacting with it, you must open a new instance of the Layout Inspector to grab a new snapshot showing the layout changes.  Each snapshot is saved in a separate .li file at projec

t-name/captures/.




Comments