问题描述
目前迁移使用谷歌地图谷歌地图Android的V2一个Android应用程序;我想地图以显示内置的位置标记,以及自定义标记。随着previous库,我用来绘制位置标记下面的自定义标记,以
Currently migrating an Android app using Google Maps to Google Maps Android v2; I want the map to display the built-in location marker, as well as custom markers. With the previous library, I used to draw the location marker 'below' custom markers, with
mapView.setReticleDrawMode(ReticleDrawMode.DRAW_RETICLE_UNDER);
我无法找到新的API类似的选项。我错过了什么?
I can't find a similar option in the new API. Did I miss something?
推荐答案
在一个有点搜索,我找不到这样的选择。
After a bit a searching, I couldn't find such an option.
我终于消除了定位销,并增加了一个类似的标记和Circle到地图;因为它是一个经典的标记,它出现下面的其他标志。
I finally removed the location pin, and added a similar Marker and Circle to the map; since it is a classic Marker, it appears below the other markers.
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));
这篇关于谷歌地图Android的API第2版:我的位置标记总是比其他指标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!