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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.