The Layout Inspector in Android Studio allows you to compare your app layout with design mockups, display a magnified or 3D view of your app, and examine details of its layout at runtime. This is especially useful when your layout is built at runtime rather than entirely in XML and the layout is behaving unexpectedly.
Layout Validation allows you to simultaneously preview layouts on different devices and display configurations, including variable font sizes or user languages, making it easy to test for a variety of common layout problems.
Open the Layout Inspector
To open the Layout Inspector, do the following:
- Run your app on a connected device or emulator.
- Click Tools > Layout Inspector.
As shown in figure 1, the Layout Inspector displays the following:
- Component Tree: The hierarchy of views in the layout.
- Layout Display: Rendering of app layout as it appears on your device or emulator, with layout bounds shown for each view.
- Layout Inspector toolbar: Tools for the Layout Inspector.
- Attributes: The layout attributes for the selected view.
Figure 1. The Layout Inspector.
Select a view
To select a view, click it in the Component Tree or the Layout Display. All of the layout attributes for the selected view appear in the Attributes panel.
If your layout includes overlapping views, you can select a view that is not in front by clicking it in the Component Tree or by rotating the layout and clicking the desired view.
Isolate a view
To work with complex layouts, you can isolate individual views so that only a subset of the layout is shown in the Component Tree and rendered in the Layout Display.
To isolate a view, right-click the view in the Component Tree and select Show Only Subtree or Show Only Parents.
To return to the full view, right-click the view and select Show All.
Hide layout borders and view labels
To hide the bounding box or view labels for a layout element, click
View Options
at the top of the Layout Display and toggle Show Borders or
Show View Label.
Compare app layout to a reference image overlay
To compare your app layout with a reference image, such as a UI mockup, you can load a bitmap image overlay in the Layout Inspector.
- To load an overlay, click Load Overlay
at the top of the Layout Inspector. The overlay is scaled to fit the layout.
- To adjust the transparency of the overlay, use the Overlay Alpha slider.
- To remove the overlay, click Clear Overlay
.
Live Layout Inspector
The Live Layout Inspector provides complete, real-time insights into your app’s UI while it’s deployed to a device or emulator running API level 29 or higher.
To enable the Live Layout Inspector, go to File > Settings > Experimental, and check the box next to Enable Live Layout Inspector. Then click the checkbox next to Live updates above the Layout Display.
The Live Layout Inspector includes a dynamic layout hierarchy, updating the Component Tree and Layout Display as views on the device change.
In addition, the property values resolution stack allows you to investigate where a resource property value originates in the source code and navigate to its location by following the hyperlinks in the properties pane.

Figure 2. Property values in the Attributes panel with hyperlinks to the properties' definitions.
Lastly, the Layout Display features an advanced 3D visualization of your app’s view hierarchy at runtime. To use this feature, in the Live Layout Inspector window simply click on the Layout and rotate it by dragging the mouse. To expand or contract the layers of the Layout, use the Layer Spacing slider.
Figure 3. Rotated 3D view of a Layout.
Layout Validation
Layout Validation is a visual tool for simultaneously previewing layouts for different devices and display configurations, helping you catch problems in your layouts earlier in the process. To access this feature, click on the Layout Validation tab in the top-right corner of the IDE window:

Figure 4. Layout Validation tab.
To switch between the available configuration sets, select one of the following from the Reference Devices dropdown at the top of the Layout Validation window:
- Reference Devices
- Custom
- Color Blind
- Font Sizes

Figure 5. Reference Devices dropdown menu option.
Reference Devices
Reference devices are a set of devices that we recommend you test against. They include phone, foldable, tablet, and desktop interfaces. You should preview how your layout appears on this set of reference devices:
Figure 6. Reference device previews in the Layout Validation tool
Custom
To customize a display configuration to preview, choose from a variety of setings including language, device, or screen orientation:
Figure 7. Configure a custom display in the Layout Validation tool
Color Blind
To help make your app more accessible for users who are color blind, validate your layout with simulations of common types of color blindness:
Figure 8. Color blindness simulation previews in the Layout Validation tool
Font Sizes
Validate your layouts at various font sizes, and improve your app's accessibility for visually impaired users by testing your layouts with larger fonts:
Figure 9. Variable font size previews in the Layout Validation tool
Capture layout hierarchy snapshots
Layout Inspector allows you to save snapshots of your running app’s layout hierarchy, so that you can easily share them with others or refer to them later.
Snapshots capture the data you would typically see when using the Layout Inspector, including a detailed 3D rendering of your layout, the component tree of your View, Compose, or hybrid layout, and detailed attributes for each component of your UI. To save a snapshot, do the following:
- Open the layout inspector.
- The Layout Inspector should connect to your app process automatically. If not, select the app process from the dropdown menu.
- When you want to capture a snapshot, click Export snapshot
from the Layout Inspector toolbar.
- In the system dialog that appears, specify the name and location you want to
save your snapshot. Make sure to save the file with a
*.li
extension.
You can then load a Layout Inspector snapshot by selecting File > Open from
the main menu bar, and opening a *.li
file.
Figure 10. Layout Inspector snapshot for the Sunflower sample app.
Inspect Compose semantics
In Compose, Semantics describe your UI in an alternative manner that is understandable for Accessibility services and for the Testing framework. You can use the Layout Inspector to inspect semantic information in your Compose layouts.
Figure 11. Semantic information displayed using the Layout Inspector.
When selecting a Compose node, use the Attributes window to check whether it declares semantic information directly, merges semantics from its children, or both. To quickly identify which nodes include semantics, either declared or merged, use select the View options dropdown in the Component Tree window and select Highlight Semantics Layers. This highlights only the nodes in the tree that include semantics, and you can use your keyboard to quickly navigate between them.