在当前位置Google地图上显示蓝点图标

Leo*_*nto 11 android google-maps

当我的蓝点图标消失时,我感到困惑.过去是我可以展示蓝点图标.但现在只需将相机放在当前位置,而不用蓝点图标.

这是我的代码:

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));
  }
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

bji*_*ang 26

您需要执行以下操作:

GoogleMap myMap;
myMap.setMyLocationEnabled(true);
Run Code Online (Sandbox Code Playgroud)

你可以在我的github上所有样本项目的代码在这里和尝试自己:)