Composable Function

DeviceConfigurationOverride

Applies DeviceConfigurationOverride to the content under test to apply some configuration override.

DeviceConfigurationOverrideFontScaleSample

@Sampled
@Composable
fun DeviceConfigurationOverrideFontScaleSample() {
    DeviceConfigurationOverride(DeviceConfigurationOverride.FontScale(1.5f)) {
        MyScreen() // will be rendered with a larger than default font scale
    }
}

DeviceConfigurationOverrideForcedSizeSample

@Sampled
@Composable
fun DeviceConfigurationOverrideForcedSizeSample() {
    DeviceConfigurationOverride(DeviceConfigurationOverride.ForcedSize(DpSize(1280.dp, 800.dp))) {
        MyScreen() // will be rendered in the space for 1280dp by 800dp without clipping
    }
}

DeviceConfigurationOverrideLayoutDirectionSample

@Sampled
@Composable
fun DeviceConfigurationOverrideLayoutDirectionSample() {
    DeviceConfigurationOverride(DeviceConfigurationOverride.LayoutDirection(LayoutDirection.Rtl)) {
        MyComponent() // will be rendered with a right-to-left layout direction
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: