如何保持一个谷歌地图标记在地图上没有滞后的中心? [英] How do I keep a Google Map marker in the center of the map without lag?
问题描述
我试图保持一个标记在地图的中心,当用户拖动相机。
I'm trying to keep a marker in the center of the map when a user drags the camera.
我目前使用的OnCameraChangeListener像这样这样做:
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.
有什么建议?
推荐答案
是的。你把更好的 MapFragment
或图形页面
在的FrameLayout
(或 RelativeLayout的
)与另一个的ImageView
或其他任何东西,并设置其重力
到中心
。
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
.
这篇关于如何保持一个谷歌地图标记在地图上没有滞后的中心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!