【发布时间】:2021-03-10 21:24:48
【问题描述】:
当我的蓝点图标消失时,我感到很困惑。过去是我可以显示蓝点图标。但现在它只是将相机缩放到我当前的位置,没有蓝点图标。
这是我的代码:
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));
}
【问题讨论】:
-
您可能需要在位置更改时更新您的标记...查看标记here 上的文档。
-
您必须单击
MyLocation按钮才能显示蓝点。您可以通过调用mMap.setMyLocationEnabled(true);来启用它,不过看起来您已经在屏幕截图中启用了它。
标签: android google-maps