Using custom camera views

Until now, we have manually changed the camera view by panning and zooming. Let's see how we can do it programmatically.

To do this, we need to use the StreetViewPanoramaCamera object. Create a StreetViewPanoramaCamera object by using the nested StreetViewPanoramaCamera.Builder class. We can set the tilt, zoom, and bearing of the street view. The methods are as follows:

Method

Parameter

Function

zoom()

Zoom level in float

By default, the zoom level is 0. The maximum zoom level depends on the panorama. If the zoom level is specified in a negative value, it is set to 0.

tilt()

Tilt angle in float

Sets the tilt angle of the camera from the horizon of the panorama. The angle ranges between -90 and 90.

bearing()

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.