While working on PatientComm, a patient communication card app, I noticed something odd on the settings screen. The text-size control was unusually tall. Even after moving the text to the top, I still had a large blank area underneath. On the web, I would click that spot in browser developer tools and see exactly how tall the selected element was. Could I do the same in Android Studio?
Use Preview to see which setting contains the empty space
This page uses Jetpack Compose, Android’s toolkit for building interfaces in Kotlin. A settings row, title, or slider can each be written as a function. Android Studio’s Preview can render a piece of UI on its own. Write an @Composable function that calls the setting you want to inspect, pass in fixed sample values such as the title and font size, and annotate the function with @Preview. Open the editor’s Split view to see the setting beside its code as you make changes.1
When investigating the gap, preview the whole text-size setting at about the same width as the original screen. Move the pointer over the title, slider, and empty area and see which component Preview outlines. Click the outline to jump to the corresponding code. If the isolated setting has a normal height, add its surrounding settings card to the preview and see at which level the empty space reappears.1
When I tried Preview, a region inside the text-size setting occupied space without showing the content I expected. I tried an adjustment and the problem remained. Then I noticed that even the Text Size title was missing. That left two questions: what was taking up the height, and had the title itself appeared in the UI?
Measure the running screen with Layout Inspector
The closest equivalent to the browser’s Inspect Element is Layout Inspector. It connects to an application being debugged on an emulator or a device. The component tree on the left shows containment: the settings screen contains a card, the card contains the text-size setting, and the setting contains the title and slider. Select a level to see its onscreen bounds alongside its attributes. Android Studio already supported inspecting Compose layouts this way in 2021.23
For the text-size setting, I would narrow it down like this:
- Run the app and open the settings screen with the gap. In Layout Inspector, select the entire card, then the text-size setting, then the slider. Look for the layer whose lower boundary sits directly beneath the empty space.
- If the slider bounds fit the slider but the outer setting extends to the bottom of the gap, check the outer layout’s specified height and padding. If the row containing the slider is as tall as the whole gap, follow that row inward.
- Look for the text component that displays
Text Sizeseparately. If you can select it, inspect the text it received and the space allocated to it. If you cannot find it, check the code for the conditions under which the title is displayed. These steps investigate different symptoms. Changing the slider height directly might miss the second one.
In PatientComm, Preview narrowed the issue down to the inside of the text-size setting, although the title was still missing and the gap remained after my edit. On August 19 I bookmarked the official Compose Preview documentation. If I revisit this kind of issue, I will first reproduce the individual setting in Preview, then check how much space each layer actually occupies on the running screen.1
References
Footnotes
-
Android Developers. (n.d.). Preview your UI with composable previews. Android Developers. Preview configuration, component outlines, and navigating to code. Bookmarked 2025-08-19. ↩ ↩2 ↩3
-
Android Developers. (n.d.). Debug your layout with Layout Inspector. Android Developers. Selecting components and inspecting hierarchy and attributes. Instructions checked on 2026-12-02. ↩
-
Android Studio team. (2021, July). Android Studio Arctic Fox (2020.3.1) Stable. Android Developers Blog. Compose Preview and Layout Inspector for Compose under “Design”. ↩