更改 Google Maps API 的“我的位置"的位置按钮 [英] Change position of Google Maps API's "My location" button

查看:35
本文介绍了更改 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

这篇关于更改 Google Maps API 的“我的位置"的位置按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆