Reputation: 1666
I'm trying to keep a marker in the center of the map when a user drags the camera.
I'm currently doing this by using an OnCameraChangeListener like so:
@Override
public void onCameraChange(CameraPosition position) {
marker.setPosition(map.getCameraPosition().target);
}
My problem with this is lag. The marker flickers and doesn't stay in place perfectly until I stop dragging.
I'm assuming a better way of doing this is to add some sort of overlay over-top the map.
Any suggestions?
Upvotes: 2
Views: 1771
Reputation: 22232
Yes. You are better of putting your MapFragment
or MapView
inside FrameLayout
(or RelativeLayout
) with another ImageView
or anything else and setting its gravity
to center
.
Upvotes: 4