Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Positioning Google maps v2 zoom in controls in Android

I've created a transparent actionbar but the zoom controls and the word 'Google' are behind it. I have no clue how to adjust their location. The default Google Map app on Android phones has them raised above the bottom action bar. Is it possible to reposition the zoom controls and the word 'Google'?

I know you can enable/disable the controls with:

 map.getUiSettings().setZoomControlsEnabled(true);

enter image description here

like image 368
ono Avatar asked Jul 01 '13 20:07

ono


People also ask

How do I custom zoom on Google Maps?

You can change the zoom level of the map using simple steps. Step 1 Go to Add or Edit Map page . Step 2 Select 'Default zoom level' in the 'Map Information section'. Step 3 click save map and see the changes.

How do I fix zoom on Google Maps?

To fix Google maps zooming problems, for Google maps default zoom you want to know how to change the zoom level on Google Maps. You can change the zoom level by going to the Edit map page and then selecting 'default zoom level' in the map information section and then clicking save map.


1 Answers

You can accomplish this with the GoogleMap.setPadding() method (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.

like image 74
Mark Doliner Avatar answered Oct 04 '22 02:10

Mark Doliner