Common
class WindowSizeClass
private constructor(
val widthSizeClass: WindowWidthSizeClass,
val heightSizeClass: WindowHeightSizeClass,
)
Window size classes are a set of opinionated viewport breakpoints to design, develop, and test responsive application layouts against. For more details check Support different screen sizes documentation.
WindowSizeClass contains a WindowWidthSizeClass and WindowHeightSizeClass, representing the window size classes for this window's width and height respectively.
See calculateWindowSizeClass to calculate the WindowSizeClass for an Activity's current window
Companion Object
Methods
calculateFromSize
Common
@ExperimentalMaterial3WindowSizeClassApi
fun calculateFromSize(
size: DpSize,
supportedWidthSizeClasses: Set<WindowWidthSizeClass> =
WindowWidthSizeClass.DefaultSizeClasses,
supportedHeightSizeClasses: Set<WindowHeightSizeClass> =
WindowHeightSizeClass.DefaultSizeClasses,
): WindowSizeClass
Calculates the best matched WindowSizeClass for a given size according to the provided supportedWidthSizeClasses and supportedHeightSizeClasses.
Parameters
| size | of the window |
| supportedWidthSizeClasses | the set of width size classes that are supported |
| supportedHeightSizeClasses | the set of height size classes that are supported |
Returns
WindowSizeClass corresponding to the given width and height |