在 LatLng 中心上方设置标记
Set Marker above LatLng center
如果我在地图中设置市场:
.addMarker(new MarkerOptions()
.position(new LatLng(lat, lang))
.title("Title")
.snippet("Description")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.dot1)))
标记本意是箭头,那么标记不是竖立位置,是指向位置。
我用的标记是一个圆圈,需要放在位置的正上方,而不是指向。
我怎样才能使标记位于位置上方而不是向上指向?
.anchor(0.5f, 0.5f) 解决了问题。
.add(map.addMarker(new MarkerOptions()
.position(new LatLng(lat, lang))
.anchor(0.5f, 0.5f)
.title("Title")
.snippet("Description")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.dot1))))
如果我在地图中设置市场:
.addMarker(new MarkerOptions()
.position(new LatLng(lat, lang))
.title("Title")
.snippet("Description")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.dot1)))
标记本意是箭头,那么标记不是竖立位置,是指向位置。
我用的标记是一个圆圈,需要放在位置的正上方,而不是指向。
我怎样才能使标记位于位置上方而不是向上指向?
.anchor(0.5f, 0.5f) 解决了问题。
.add(map.addMarker(new MarkerOptions()
.position(new LatLng(lat, lang))
.anchor(0.5f, 0.5f)
.title("Title")
.snippet("Description")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.dot1))))