ForcedSize
Function
Common
expect fun DeviceConfigurationOverride.Companion.ForcedSize(
size: DpSize
): DeviceConfigurationOverride
A DeviceConfigurationOverride that overrides the available size for the contained content.
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).
Parameters
| size | the DpSize to force the contained content to render in, changing density if necessary |
Returns
a DeviceConfigurationOverride that forces the content size. |
Android
actual fun DeviceConfigurationOverride.Companion.ForcedSize(
size: DpSize
): DeviceConfigurationOverride
Code Examples
DeviceConfigurationOverrideForcedSizeSample
@Composable
fun DeviceConfigurationOverrideForcedSizeSample() {
DeviceConfigurationOverride(DeviceConfigurationOverride.ForcedSize(DpSize(1280.dp, 800.dp))) {
MyScreen() // will be rendered in the space for 1280dp by 800dp without clipping
}
}
