设置地图的位置中心 - GMaps实现V2 - 机器人 [英] Set Location Center of Map - GMaps v2 - Android

查看:189
本文介绍了设置地图的位置中心 - GMaps实现V2 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何设置地图的中心用GMaps实现v2中的具体位置?这是我做的使用GMaps实现V1:

How do I set the center of the map to a specific location using GMaps v2? This is how I did it using GMaps v1:

public void setCenter( LatLng point )
{
  if( point.latitude*1000000 != 0 && point.longitude*1000000 != 0 )
  {
     if( mMapController != null )
     {
        mMapController.setCenter( point );
     }
     /*else if( mOpenStreetMapViewControllerSource != null )
     {
        mOpenStreetMapViewControllerSource.getController().setCenter( new org.osmdroid.util.GeoPoint( point.getLatitudeE6(), point.getLongitudeE6() ) );
        mPostponedSetCenterPoint = point;
     }*/
  }
}

我已经通过API找GMaps实现v2和无法找到和类似的功能。如何做到这一点?

I have looked through the API for GMaps v2 and can't find and similar functionality. How do I do this?

推荐答案

您可以试试:

map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), zoom));

其中,地图的GoogleMap的实例。

where map is the GoogleMap instance.

这篇关于设置地图的位置中心 - GMaps实现V2 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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