Android的谷歌地图V2 - 为myLocation设置缩放级别 [英] Android Google Maps v2 - set zoom level for myLocation

查看:1001
本文介绍了Android的谷歌地图V2 - 为myLocation设置缩放级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能改变myLocation缩放级别与新的谷歌地图API第2版? 如果设置GoogleMap.setEnableMyLocation(真);你在地图上的一个按钮来找到你的位置。如果你点击它,地图将带你到你的位置,并放大到一定程度。我可以改变这个变焦是少跌多?

Is it possible to change the zoom level for myLocation with the new Google Maps API v2? If you set GoogleMap.setEnableMyLocation(true); you get a button on the map to find your location. If you click on it, the map will bring you to your location and zoom it in to some level. Can I change this zoom to be less or more?

推荐答案

这是值得怀疑的,你可以点击使用默认myLocation标记更改。但是,如果你想该应用会自动放大您的位置一旦被发现,我想看看我的回答<一href="http://stackoverflow.com/questions/13739990/map-view-following-user-mylocationoverlay-type-functionality-for-android-maps/13753518#13753518">this问题

It's doubtful you can change it on click with the default myLocation Marker. However, if you would like the app to automatically zoom in on your location once it is found, I would check out my answer to this question

请注意,我所提供的答案没有放大,但是如果你修改onLocationChanged方法是类似下面,你可以选择任何缩放级别你喜欢的:

Note that the answer I provided does not zoom in, but if you modify the onLocationChanged method to be like the one below, you can choose whatever zoom level you like:

@Override
public void onLocationChanged(Location location) 
{
    if( mListener != null )
    {
        mListener.onLocationChanged( location );

        //Move the camera to the user's location and zoom in!
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 12.0f));
    }
}

这篇关于Android的谷歌地图V2 - 为myLocation设置缩放级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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