android - 如何使用适用于 Android V2 的 Google Maps 处理 map 移动端?

标签 android google-maps android-mapview google-maps-android-api-2

我想在 map 中心更改后立即对地址进行地理编码。

如何使用新的 Android 版 Google map V2 处理 map 移动端? (我说的是用户用手指拖动 map 的情况)

最佳答案

查看新的 map API。

 @Override
public void onMapReady(GoogleMap map) {
    mMap = map;

    mMap.setOnCameraIdleListener(this);
    mMap.setOnCameraMoveStartedListener(this);
    mMap.setOnCameraMoveListener(this);
    mMap.setOnCameraMoveCanceledListener(this);

    // Show Sydney on the map.
    mMap.moveCamera(CameraUpdateFactory
            .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10));
}

@Override
public void onCameraMoveStarted(int reason) {

    if (reason == OnCameraMoveStartedListener.REASON_GESTURE) {
        Toast.makeText(this, "The user gestured on the map.",
                       Toast.LENGTH_SHORT).show();
    } else if (reason == OnCameraMoveStartedListener
                            .REASON_API_ANIMATION) {
        Toast.makeText(this, "The user tapped something on the map.",
                       Toast.LENGTH_SHORT).show();
    } else if (reason == OnCameraMoveStartedListener
                            .REASON_DEVELOPER_ANIMATION) {
        Toast.makeText(this, "The app moved the camera.",
                       Toast.LENGTH_SHORT).show();
    }
}

@Override
public void onCameraMove() {
    Toast.makeText(this, "The camera is moving.",
                   Toast.LENGTH_SHORT).show();
}

@Override
public void onCameraMoveCanceled() {
    Toast.makeText(this, "Camera movement canceled.",
                   Toast.LENGTH_SHORT).show();
}

@Override
public void onCameraIdle() {
    Toast.makeText(this, "The camera has stopped moving.",
                   Toast.LENGTH_SHORT).show();
}

developers.google.com sample

关于android - 如何使用适用于 Android V2 的 Google Maps 处理 map 移动端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13702117/

相关文章:

javascript - MarkerWIthLabel map 库 : this. setValue 不是函数

javascript - 获取谷歌地图中已创建标记的位置(纬度,经度)

java - Android MapView - 如何获取 map 选定部分的中心?

android - 警报仅在我处于设置它的 Activity 中时触发

android - 当我尝试上传到 google play 商店时,Cordova 构建和签名错误,没有 v2 签名

java - OpenGL ES 1.0 安卓 : Unable to load multiple textures

Android - Google Maps API v2 - NoClassDefFoundError

Android MapView + Tab 示例

android - 如何从主视图访问 map fragment

android - 无法发送到 Cloud Firestore