Skip to content
tezvyn:

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

Source: developer.android.comMediumHow cards are made

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's really being asked

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.

The full answer

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.

The mistakes people make

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.

What usually comes next

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?

A 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.

Interview question

A view is clipped at runtime but looks correct in the Layout Editor. What does the runtime inspection tool surface that the static preview cannot?

  • a.Live bounds, visibility states, parent-child relationships, and 3D layer visualizationCorrect
  • b.Real-time logcat output of the view's layout calculations
  • c.A window hierarchy extracted using the standalone Android Monitor tool
  • d.The static XML attributes as authored in the layout file
Why?

Layout Inspector connects to a running process and reveals live bounds, visibility states, and 3D layering that static previews cannot. The Layout Editor only displays authored XML, so it will not expose runtime measure or constraint errors that cause clipping.

Just read this? Test yourself on what you have been reading.

Read the original → developer.android.com

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on android — each one lists the topics its interview covers.

See open roles