如何让我的谷歌地图应用程序从我当前位置的缩放开始

时间:2013-05-25 17:16:07

标签: android eclipse google-maps

如何在Android上启动谷歌地图应用程序,在不按或做任何事情的情况下放大我当前的位置?

修改。问题解决了

Criteria cri= new Criteria();
    String bbb = locationmanager.getBestProvider(cri, true);
    Location myLocation = locationmanager.getLastKnownLocation(bbb);

    double lat= myLocation.getLatitude();
    double long = myLocation.getLongitude();
    LatLng ll = new LatLng(lat, long);

    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 20));

2 个答案:

答案 0 :(得分:4)

问题解决了

Criteria cri= new Criteria();
String bbb = locationmanager.getBestProvider(cri, true);
Location myLocation = locationmanager.getLastKnownLocation(bbb);

double lat= myLocation.getLatitude();
double long = myLocation.getLongitude();
LatLng ll = new LatLng(lat, long);

mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 20));

答案 1 :(得分:0)

你可以这样做

CameraUpdate center= CameraUpdateFactory.newLatLng(new LatLng(lat,long));
CameraUpdate zoom=CameraUpdateFactory.zoomTo(5);

map.moveCamera(center);
map.animateCamera(zoom);