Move the Map by Keeping the marker in center

2020-03-25 16:18发布

Whenever I move the map,Marker is also moving with that But I want to move the map by keeping the marker at the center of Map as constant.

How can i acheive this?

2条回答
不美不萌又怎样
2楼-- · 2020-03-25 16:26
    CameraPosition cameraPos = new CameraPosition.Builder()
                .target(new LatLng(Double.parseDouble(currentLAT), Double.parseDouble(currentLNG)))
                .zoom(10).bearing(0).tilt(0).build();
        mapView.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPos), null);

Set this way:

查看更多
做个烂人
3楼-- · 2020-03-25 16:27

Why don't you add your marker as a view. overlay it on top of the map.

<RelaiveLayout  android:layout_width="wrap_content" android:layout_height="wrap_content" >
<mapView ...  />
<ImageView  android:center_in_parent="true" ... android:src="@drawable/urmarker" />
</RelativeLayout>

or if your using a MapFragment add the marker to the fragment activity

查看更多
登录 后发表回答