{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

WindowSizeClass.Companion

public static class WindowSizeClass.Companion


Summary

Public methods

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

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

Public methods

calculateFromSize

@ExperimentalMaterial3WindowSizeClassApi
public static final @NonNull WindowSizeClass calculateFromSize(
    @NonNull DpSize size,
    @NonNull Set<@NonNull WindowWidthSizeClass> supportedWidthSizeClasses,
    @NonNull Set<@NonNull WindowHeightSizeClass> supportedHeightSizeClasses
)

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

Parameters
@NonNull DpSize size

of the window

@NonNull Set<@NonNull WindowWidthSizeClass> supportedWidthSizeClasses

the set of width size classes that are supported

@NonNull Set<@NonNull WindowHeightSizeClass> supportedHeightSizeClasses

the set of height size classes that are supported

Returns
@NonNull WindowSizeClass

WindowSizeClass corresponding to the given width and height