WindowSize
A [DeviceConfigurationOverride] that overrides the window size for the contained content.
WindowSize
Function
Common
expect fun DeviceConfigurationOverride.Companion.WindowSize(
size: DpSize
): DeviceConfigurationOverride
A DeviceConfigurationOverride that overrides the window size for the contained content.
Like ForcedSize, this is only suitable for tests, since this will override LocalDensity to
ensure that the size is met (as opposed to Modifier.requiredSize which will result in
clipping).
Unlike ForcedSize, this override will override LocalWindowInfo and LocalConfiguration on
Android to reflect the requested size.
Parameters
| size | the DpSize to force the window size to appear as, changing density if necessary |
Returns
a DeviceConfigurationOverride that forces the window size. |
Android
actual fun DeviceConfigurationOverride.Companion.WindowSize(
size: DpSize
): DeviceConfigurationOverride
Code Examples
DeviceConfigurationOverrideWindowSizeSample
@Composable
fun DeviceConfigurationOverrideWindowSizeSample() {
DeviceConfigurationOverride(DeviceConfigurationOverride.WindowSize(DpSize(1280.dp, 800.dp))) {
MyScreen() // will be rendered with an apparent window size of 1280dp by 800dp without
// clipping
}
}