Window Size Class is an API from Jetpack WindowManager that divides the application window into three categories: Compact, Medium and Expanded. Instead of checking physical resolution or pixel density, the classes analyze the available width in dp — this gives a predictable result on any device. According to Android Developers Documentation (2025), Window Size Class has become the standard for adaptive interfaces in Jetpack Compose and View system thanks to WindowManager.
Key Takeaways
Window Size Class is an Android platform API included in the Jetpack WindowManager library that classifies the available application window space into three categories. Unlike the traditional approach with resource qualifiers (small/large/xlarge), Window Size Class provides a discrete set of values that a developer can rely on when designing an interface.
The API appeared in Android 7.0 Nougat as part of multi-window mode support, but active adoption began with Jetpack WindowManager 1.1 (2022). Google recommends Window Size Class as the primary tool for building adaptive layouts instead of checking screen width through Display.getSize().
Classification is based on window width in dp, not physical size or pixel density. This means that two devices with different resolutions but the same width in dp will receive the same class — the interface will be predictably identical.
Compact — class for windows up to 600 dp wide. Phone in portrait mode, most foldables (Galaxy Z Flip) in folded state. The interface is built in one column, navigation via Bottom Navigation.
Medium — class for windows 600–840 dp wide. Tablet in portrait, phone in landscape, foldable device in half-open state. The interface uses two columns — for example, a list on the left and details on the right. Navigation Rail replaces Bottom Navigation.
Expanded — class for windows from 840 dp wide. Tablet in landscape, desktop window, foldable device in unfolded state. The interface can use three or more panels, Permanent Navigation Drawer, tool panels.
In Material Design 3, adaptive components are defined for each class: Navigation Rail for Medium, Navigation Drawer for Expanded, Bottom Navigation for Compact. The developer does not need to select breakpoints — they are already defined by the API.
Window Size Class is calculated based on the current width of the application window in dp, taking into account system elements — status bar, navigation bar, screen split in Split Screen mode. The API triggers when the window configuration changes: device rotation, entering multi-window mode, unfolding a foldable device.
To obtain the class, the WindowSizeClass from the androidx.window library is used. The developer subscribes to a Flow (Kotlin) or LiveData (Java) that automatically updates the class with every window size change — without manual onConfigurationChanged handling.
Classification happens in three steps. First — measuring the current window width in pixels. Second — converting to dp via DisplayMetrics.density. Third — comparing the obtained value with thresholds: less than 600 dp — Compact, 600–840 — Medium, from 840 — Expanded.
val windowSizeClass = currentWindowAdaptiveInfo().windowSizeClass()
when (windowSizeClass.windowWidthSizeClass) {
WindowWidthSizeClass.COMPACT -> // compact width
WindowWidthSizeClass.MEDIUM -> // medium width
WindowWidthSizeClass.EXPANDED -> // expanded width
}
In addition to width (windowWidthSizeClass), the API provides a class for window height (windowHeightSizeClass) — useful for landscape orientation and desktop windows.
In Jetpack Compose, Window Size Class is used through the currentWindowAdaptiveInfo() function, which returns WindowAdaptiveInfo with width and height classes. This function takes into account not only the window size but also the input type (keyboard, mouse, touch) — through WindowPosture and WindowLayoutInfo.
A typical scenario is switching between layouts depending on the class. For example, on Compact a BottomSheet with selection is displayed, on Medium — a side panel, on Expanded — a permanent Navigation Drawer.
@Composable
fun AdaptiveNavigation(windowSizeClass: WindowWidthSizeClass) {
when (windowSizeClass) {
WindowWidthSizeClass.COMPACT -> BottomNavigation()
WindowWidthSizeClass.MEDIUM -> NavigationRail()
WindowWidthSizeClass.EXPANDED -> NavigationDrawer()
}
}
In Material Design 3, NavigationSuiteScaffold components automatically adapt to Window Size Class — the developer does not need to write conditional logic.
Material Design 3 (Material You) is fully integrated with Window Size Class. The adaptive layout system in Material 3 determines which navigation component to use for each class: BottomNavigation for Compact, NavigationRail for Medium, NavigationDrawer for Expanded.
This integration works at the Adaptive API level, which combines Window Size Class with other signals — FoldState (foldable device) and WindowPosture (screen position). Adaptive API is available through the material3-adaptive library.
Material 3 provides four adaptive top-level components: ListDetailPaneScaffold, SupportingPaneScaffold, NavigationSuiteScaffold and AdaptiveSheet. Each of them changes its behavior depending on Window Size Class without additional configuration.
| Class | Navigation Component | Pane Scaffold |
|---|---|---|
| Compact | Bottom Navigation | Hidden pane |
| Medium | Navigation Rail | Sliding pane |
| Expanded | Navigation Drawer | Permanent pane |
Using Window Size Class provides three key advantages in mobile development. First — predictability: instead of hundreds of screen size combinations, the developer works with three classes. This radically reduces the number of test scenarios and bugs related to layout.
Second — automatic adaptation to multi-window mode. When the user enters Split Screen, the window width changes — Window Size Class recalculates instantly, and the interface adapts. Without this API, the app in split screen shows a stripped-down phone interface version.
Third — consistency with Material Design 3. Google has built Window Size Class into the adaptive component system, so interfaces built on Material 3 automatically follow Google's large screen design recommendations without extra work.
Frequently Asked Questions
Screen Size Buckets (small/large/xlarge) is an outdated approach from Android 1.6–6.0 based on the physical screen size. Window Size Class focuses on the available window width in dp and works in real time when the window size changes.
Window Size Class is available through Jetpack WindowManager on Android 7.0+ with a backport library. For Android 6 and below — only Compact, since multi-window is absent. Use fallback via WindowMetrics.
When unfolding the device, the window width changes and Window Size Class recalculates automatically. The class can change from Compact to Expanded due to the increase of the available area.
Yes, through WindowManager in Activity or Fragment. After obtaining WindowSizeClass, use conditional logic to switch between XML layouts or change View visibility.
For window height, the thresholds differ: Compact — up to 480 dp, Medium — 480–900 dp, Expanded — from 900 dp. WindowHeightSizeClass is useful in landscape orientation and on desktop.
Summary
We will develop a mobile application turnkey
IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.
Read also