Which Android Studio tool inspects view hierarchy and what does it show?

Tests practical knowledge of runtime UI debugging tools. A strong answer names Layout Inspector, cites live view hierarchy with bounds and attributes, and distinguishes it from the static Layout Editor. Red flag: citing Logcat or the preview pane instead.
WHAT THIS TESTS: This question checks whether you can distinguish between static layout design and runtime layout debugging. Interviewers want to see that you know Layout Inspector is the correct embedded tool in Android Studio, that you understand what runtime information it surfaces, and that you do not rely on outdated or incorrect alternatives.
A GOOD ANSWER COVERS: First, name Layout Inspector explicitly and locate it under the View menu or App Inspection tool window in modern Android Studio versions. Second, explain that it connects to a running process and snapshots the complete view hierarchy, showing parent-child relationships, exact pixel dimensions, visibility states, and applied attributes. Third, mention the 3D visualization mode that lets you rotate and peel back layers to diagnose overlapping or offscreen views. Fourth, note that it supports both the traditional View system and Jetpack Compose, though the inspection surface differs. Fifth, briefly contrast it with the static Layout Editor, which only shows XML previews without runtime data.
COMMON WRONG ANSWERS: Confusing Layout Inspector with Layout Editor is the most frequent mistake. Another error is citing hierarchyviewer or monitor from the deprecated standalone Android Monitor tools, which have been removed from modern Android Studio. Some candidates suggest using Logcat with manual logging of view dimensions, which is inefficient and imprecise. Claiming you need a rooted device or external tool is also incorrect since Layout Inspector works on standard debug builds.
LIKELY FOLLOW-UPS: How would you debug a layout that looks correct in the preview but breaks at runtime? What is the performance impact of using Layout Inspector on a running app? How does Compose inspection differ from traditional View inspection in the tool? Can you modify attribute values live, and if so, how does that compare to Compose Preview?
ONE CONCRETE EXAMPLE: Suppose a button is clipped at the bottom of a screen on a specific device. You would open Layout Inspector, select the running process, locate the button in the component tree, and check its measured height and bottom margin against the parent container. You might enable the 3D view to see if a sibling view is drawing over it or if the parent ConstraintLayout has an incorrect constraint pushing the button out of bounds. The tool shows exact dp and px values so you can compare them with the design spec without guessing.
Source: developer.android.com
Read the original → developer.android.com
- #android
- #android-studio
- #layout-inspector
- #debugging
- #ui
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.