如何在Android中的谷歌地图中添加一个引脚(不是标记)?
我知道如何添加标记,如下所示:
map.addMarker(new MarkerOptions()
.position(new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude()))
.title(getString(R.string.start_location_marker)));
但我想要一个别针,而不是一个标记
针看起来像这样:
pin
标记如下:
marker
答案 0 :(得分:1)
将您的图片图像设置为标记,称为自定义标记
@Override
public void onMapReady(GoogleMap googleMap) {
BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.pin);
LatLng latLng = new LatLng(21.4225, 39.8262);
googleMap.addMarker(new MarkerOptions().position(latLng).title("Mecca").icon(icon)).showInfoWindow();
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));
}