Using the lite mode

The lite mode can be used to display a map as a static image. You cannot zoom or pan an image while using the lite mode. This is helpful in cases where you need to display less information. Now, let's see how to use this mode in an Android application.

The lite mode can be easily enabled from the XML MapFragment layout. Use the liteMode attribute of a namespace map. The map namespace should be specified initially. To set the zoom level, use the cameraZoom attribute. To display a map for a particular latitude and longitude, use the cameraTargetLat and cameraTargetLng attribute.

Here is the code for our layout:

<?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" ...

Get Learning Android Google Maps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.