Skip to main content

Safe area

Vehicles can have various shapes of displays (for example circle displays, displays with a rounded corner) so the app should be able to fit its content properly.

Navigation SDK UX Framework allows developers to set the margins around UI elements defining so-called "Safe Area" - it's a rectangular area the whole UI fits in (excluding the map, the map should take the whole available space).

To redefine these margins you need to call DashNavigationFragment.setSafeAreaPaddings function:

val navigationFragment = DashNavigationFragment.newInstance()
navigationFragment.setSafeAreaPaddings(300, 100, 200, 0)
supportFragmentManager.beginTransaction()
.replace(R.id.container, navigationFragment)
.commitNow()

Real-time updates are also supported:

val fragment = supportFragmentManager.findFragmentById(R.id.container)
if (fragment is DashNavigationFragment) {
fragment.setSafeAreaPaddings(300, 100, 200, 400)
}

The function can be called quite often to achieve animation effect.

Was this page helpful?