Robert Estivill Robert Estivill - 1 year ago 103
Android Question

Android Maps Library V2 zoom controls custom position

How can i customize the position of the builtin zoom controls in a GoogleMap V2 ?

There are a lot of questions related to this topic for the Version 1 of Google Maps library.

Placing Zoom Controls in a MapView

How to reposition built-in zoom controls in MapView?

How to layout zoom Control with setBuiltInZoomControls(true)?

However, i wasn't able to find any questions in relation to the V2 of the library.

In the V2, there's no method

(LinearLayout) mapView.getZoomControls();

all the previously mentioned questions becomes obsolete.

Thanks in advance

Answer Source

Depending on what you're trying to do, you might find GoogleMap.setPadding() useful (added in September 2013).

map.setPadding(leftPadding, topPadding, rightPadding, bottomPadding);

From the API docs:

This method allows you to define a visible region on the map, to signal to the map that portions of the map around the edges may be obscured, by setting padding on each of the four edges of the map. Map functions will be adapted to the padding. For example, the zoom controls, compass, copyright notices and Google logo will be moved to fit inside the defined region, camera movements will be relative to the center of the visible region, etc.

Also see the description of how padding works in GoogleMap.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download