更改 Google Maps API 的“我的位置"的位置按钮
问题描述:
我使用的是 Google Maps Android API v2,我需要一种方法来确定我的位置"按钮的位置.
I am using the Google Maps Android API v2, and I need a way to chance the position of the "My Location" button.
我得到这样的我的位置"按钮:
I get the "My Location" button like this:
GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
final GoogleMap map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
// This gets the button
map.setMyLocationEnabled(true);
答
只需使用 GoogleMap.setPadding(left, top, right, bottom),它允许您指出地图中可能被其他视图遮挡的部分.设置填充会重新定位标准地图控件,而相机更新将使用填充区域.
Just use GoogleMap.setPadding(left, top, right, bottom), which allows you to indicate parts of the map that may be obscured by other views. Setting padding re-positions the standard map controls, and camera updates will use the padded region.
https://developers.google.com/maps/documentation/android/map#map_padding一个>