In my Android application I need to place marker at exact position on map. I pin a marker on map with 51.507351, -0.127758 (London) location. I used the following code to do the work.
googleMap.addMarker(new MarkerOptions().position(
new LatLng(51.507351, -0.127758)).icon(
BitmapDescriptorFactory.fromBitmap(BitmapFactory
.decodeResource(getResources(),
R.drawable.q_icon))));
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(51.507351, -0.127758), 20));
And this my marker drawable image:
Now my problem is, the "Q" symbol is placed at the location of 51.507351, -0.127758. I need to place marker at the position where bottom arrow starts.
Please see the picture so that you can understand my question.
How can I do this? please help me.
The logic behind how the markers are anchored is something like this for a 4px-by-2px image:
Also take into consideration that based on your bitmap resource, it could be positioned a little different than you would expect, because they actually approximate to the nearest snap position. So in the example above, your anchor points will snap to this position:
Documentation
Use
MarkerOption
'sanchor
method: https://developers.google.com/android/reference/com/google/android/gms/maps/model/MarkerOptions.html#anchor(float,%20float)For your case:
Try this,
Try this one: