在当前位置Google地图上显示蓝色圆点图标 [英] Show blue dots icon on current location Google Maps

查看:1567
本文介绍了在当前位置Google地图上显示蓝色圆点图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的蓝点图标消失时,我感到困惑。过去是我可以显示蓝点图标。但现在它只是将相机放大到当前位置,没有蓝点图标。

I'm getting confused when my blue dot icon is dissapeared. The past is i can show the blue dot icon. But now it just zoom the camera on my current location without blue dot icon.

以下是我的代码:

Here is my code:

private void handleNewLocation(Location location) {
    Log.d(TAG, location.toString());
    double currentLatitude = location.getLatitude();
    double currentLongitude = location.getLongitude();
    LatLng latLng = new LatLng(currentLatitude, currentLongitude);
    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 21));
  }

推荐答案

您需要做如下操作:

GoogleMap myMap;
myMap.setMyLocationEnabled(true);

您可以在我的github上获得所有示例项目代码 here

You can get all sample project code on my github here and try yourself:)

这篇关于在当前位置Google地图上显示蓝色圆点图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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