Navigation

Function
Android
fun DeviceConfigurationOverride.Companion.Navigation(
    @NavigationType navigationType: Int,
    isHidden: Boolean = false,
): DeviceConfigurationOverride

A DeviceConfigurationOverride that overrides the current navigation type and whether it is hidden.

Parameters

navigationType the navigation type to render the content under test in. This should be one of the Configuration.NAVIGATION_* values.
isHidden if true, render the content under test with hidden navigation.

Returns

a DeviceConfigurationOverride that specifies the navigation type for the content under test.

Code Examples

DeviceConfigurationOverrideNavigation

@Composable
fun DeviceConfigurationOverrideNavigation() {
    DeviceConfigurationOverride(
        DeviceConfigurationOverride.Navigation(
            navigationType = Configuration.NAVIGATION_DPAD,
            isHidden = false,
        )
    ) {
        LocalConfiguration.current.navigation // will be Configuration.NAVIGATION_DPAD
        LocalConfiguration.current.navigationHidden // will be Configuration.NAVIGATIONHIDDEN_NO
    }
}