Move the Map by Keeping the marker in center

前端 未结 2 768
天命终不由人
天命终不由人 2021-01-14 02:25

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条回答
  • 2021-01-14 02:47
        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:

    0 讨论(0)
  • 2021-01-14 02:52

    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

    0 讨论(0)
提交回复
热议问题