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

Summary

Public companion functions

WindowSizeClass
@ExperimentalMaterial3WindowSizeClassApi
calculateFromSize(
    size: DpSize,
    supportedWidthSizeClasses: Set<WindowWidthSizeClass>,
    supportedHeightSizeClasses: Set<WindowHeightSizeClass>
)

Calculates the best matched WindowSizeClass for a given size according to the provided supportedWidthSizeClasses and supportedHeightSizeClasses.

Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open String
Cmn

Public properties

WindowHeightSizeClass

height-based window size class (WindowHeightSizeClass)

Cmn
WindowWidthSizeClass

width-based window size class (WindowWidthSizeClass)

Cmn

Public companion functions

calculateFromSize

@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: DpSize

of the window

supportedWidthSizeClasses: Set<WindowWidthSizeClass> = WindowWidthSizeClass.DefaultSizeClasses

the set of width size classes that are supported

supportedHeightSizeClasses: Set<WindowHeightSizeClass> = WindowHeightSizeClass.DefaultSizeClasses

the set of height size classes that are supported

Returns
WindowSizeClass

WindowSizeClass corresponding to the given width and height

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

heightSizeClass

val heightSizeClassWindowHeightSizeClass

height-based window size class (WindowHeightSizeClass)

widthSizeClass

val widthSizeClassWindowWidthSizeClass

width-based window size class (WindowWidthSizeClass)