Sorry, you need to enable JavaScript to visit this website.

Map UI Extensions

Map UI Extensions

Android Maps SDK provides the following built-in UI views:

  • Compass button

  • Current location button

  • Panning controls

  • Zooming controls

You can toggle the visibility of these views using the UiSettings class.
Changes made on this class are reflected on the map immediately.
Each UI element has a pre defined style that determines its position relative to the edge of the map.
This style can be overridden to provide custom position, adjust size or replace default colors.
It is also possible to alter these parameters in runtime by modifying view’s LayoutParams.

To use this library, add the following dependency to the build.gradle file:

api("com.tomtom.online:sdk-maps-ui-extensions:2.+")
Compass

By default, the compass button is enabled and located in the top left corner of the map - ‘MapView'. The compass appears only when the map orientation is different than zero (‘North' position). When the user clicks on the compass button, the map orientation is set to zero and the compass disappears.

 



image

Default

image

Pressed

image

North up

 

  • To disable the compass button:

tomtomMap.getUiSettings().getCompassView().hide();

 

  • To enable the compass button:

tomtomMap.getUiSettings().getCompassView().show();

 

  • To override default style:

<style name="CompassView" parent="BaseCompactView">
    <item name="android:layout_gravity">top|start</item>
    <item name="android:layout_marginStart">@dimen/compass_default_margin_start</item>
    <item name="android:layout_marginTop">@dimen/compass_default_margin_top</item>
</style>

 

Current location

By default, the current location button is enabled and placed in the bottom left corner of the map -'MapView'. The current location button appears only when the map center position on the screen is different from user’s current location. When the user clicks on the current location button, the map location is set to the user’s location and the button disappears.
The default action for the button centres the map on the user’s location if 'MapView' has set up shown current position on 'YES'.

 



image

Default

image

Pressed

 

  • To disable the current location button:

tomtomMap.getUiSettings().getCurrentLocationView().hide();

 

  • To enable the current location button:

tomtomMap.getUiSettings().getCurrentLocationView().show();

 

  • To override default style:

<style name="CenterOnCurrentLocationView" parent="BaseCompactView">
    <item name="android:layout_gravity">bottom|start</item>
    <item name="android:layout_marginStart">@dimen/compass_default_margin_start</item>
    <item name="android:layout_marginBottom">@dimen/current_location_default_margin_bottom
    </item>
</style>

 

Panning controls

By default, the panning controls view is disabled and it is placed vertically in the center and horizontally on right site of the map -'MapView'.
The default action for the view is to move the map in desired direction.

 



image
image

Pan down

image
image

Pan left

image
image

Pan right

image
image

Pan up

 

  • To enable the panning controls:

tomtomMap.getUiSettings().getPanningControlsView().show();

 

  • To disable the panning controls:

tomtomMap.getUiSettings().getPanningControlsView().hide();

 

  • To override default style:

<style name="ArrowButton" parent="GenericControlButton" />

<style name="ArrowButtonsGroup" parent="GenericControlButtonsGroup">
    <item name="android:layout_width">150dp</item>
    <item name="android:layout_marginRight">80dp</item>
</style>

 

Zooming controls

By default, the zooming controls view is disabled and it is placed vertically in the center and horizontally on right site of the map -'MapView'.
The default action for the view is to zoom in or zoom out the map.

 



image
image

Zoom in

image
image

Zoom out

 

  • To enable the zooming controls:

tomtomMap.getUiSettings().getZoomingControlsView().show();

 

  • To disable the zooming controls:

tomtomMap.getUiSettings().getZoomingControlsView().hide();

 

  • To override default style:

<style name="ZoomButton" parent="GenericControlButton" />

<style name="ZoomButtonsGroup" parent="GenericControlButtonsGroup">
    <item name="android:layout_width">@dimen/control_button_default_size</item>
</style>