谷歌地图Android API v2:我的位置标记是否总是高于其他标记?
目前正在将使用谷歌地图的Android应用程序迁移到谷歌地图Android v2;我希望地图显示内置的位置标记以及自定义标记。 在上一个库中,我使用谷歌地图Android API v2:我的位置标记是否总是高于其他标记?,android,android-mapview,google-maps-android-api-2,android-maps-v2,Android,Android Mapview,Google Maps Android Api 2,Android Maps V2,目前正在将使用谷歌地图的Android应用程序迁移到谷歌地图Android v2;我希望地图显示内置的位置标记以及自定义标记。 在上一个库中,我使用 mapView.setReticleDrawMode(ReticleDrawMode.DRAW_RETICLE_UNDER); 我在新的API中找不到类似的选项。我错过了什么吗?经过一番搜索,我找不到这样的选择 我最终移除了定位销,并在地图上添加了一个类似的标记和圆圈;因为它是一个经典的标记,所以它出现在其他标记的下面 map.setMyLoca
mapView.setReticleDrawMode(ReticleDrawMode.DRAW_RETICLE_UNDER);
我在新的API中找不到类似的选项。我错过了什么吗?经过一番搜索,我找不到这样的选择 我最终移除了定位销,并在地图上添加了一个类似的标记和圆圈;因为它是一个经典的标记,所以它出现在其他标记的下面
map.setMyLocationEnabled(false);
// ...
// get the current location with Android LocationManager in some way
// ...
// then draw it on the map when it changes:
if (null == getMyLocation())
return;
if (null != locationMarker) {
locationMarker.remove();
}
if (null != locationCircle) {
locationCircle.remove();
}
LatLng loc = getMyLocation();
locationMarker = map.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.blue_pin_12))
.position(getMyLocation()).anchor(0.5f, 0.5f));
float accuracy = getMyLocationAccuracy();
locationCircle = map.addCircle(new CircleOptions().center(loc)
.radius(accuracy)
.strokeColor(Color.argb(255, 0, 153, 255))
.fillColor(Color.argb(30, 0, 153, 255)).strokeWidth(2));
我想我可能有办法解决这个问题。如果需要,请通知我。非常感谢您的代码片段。但是如何获得准确度呢?getMyLocationAccuracy()是什么?API是从这个4年前的答案开始发展的。您可以通过location.getAccurance()获得精度